blob: 93aa285936dd555f4016aba4177e40736a6e9e28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <linux/rfkill.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
static struct rfkill *rfk;
static void test_poll(struct rfkill *rfkill, void *data)
{
printk(KERN_DEBUG "poll test rfkill\n");
}
static void test_query(struct rfkill *rfkill, void *data)
{
printk(KERN_DEBUG "query test rfkill\n");
}
static int test_set_block(void *data, bool blocked)
{
printk(KERN_DEBUG "set test rfkill (%s)\n",
blocked ? "blocked" : "active");
return 0;
}
static struct rfkill_ops ops = {
.poll = test_poll,
.query = test_query,
.set_block = test_set_block,
};
int mod_init(void)
{
int err;
rfk = rfkill_alloc("fake", NULL, RFKILL_TYPE_WLAN, &ops, NULL);
if (!rfk)
return -ENOMEM;
err = rfkill_register(rfk);
if (err)
rfkill_destroy(rfk);
return err;
}
module_init(mod_init);
void mod_exit(void)
{
rfkill_unregister(rfk);
rfkill_destroy(rfk);
}
module_exit(mod_exit);
|