diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2006-03-23 11:11:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-22 14:22:50 -0400 |
commit | 12003375acd879e498c6c511faf27531296f9640 (patch) | |
tree | f69001169d28c6e56e1a12e04420683620e31d79 /drivers/w1/w1_netlink.h | |
parent | 81f6075ebcf3b0800321b7d81e4845d6ad9566d8 (diff) |
[PATCH] w1: Userspace communication protocol over connector.
There are three types of messages between w1 core and userspace:
1. Events. They are generated each time new master or slave device found
either due to automatic or requested search.
2. Userspace commands. Includes read/write and search/alarm search comamnds.
3. Replies to userspace commands.
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/w1_netlink.h')
-rw-r--r-- | drivers/w1/w1_netlink.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h index eb0c8b3152c8..5644221f9a44 100644 --- a/drivers/w1/w1_netlink.h +++ b/drivers/w1/w1_netlink.h | |||
@@ -23,37 +23,55 @@ | |||
23 | #define __W1_NETLINK_H | 23 | #define __W1_NETLINK_H |
24 | 24 | ||
25 | #include <asm/types.h> | 25 | #include <asm/types.h> |
26 | #include <linux/connector.h> | ||
26 | 27 | ||
27 | #include "w1.h" | 28 | #include "w1.h" |
28 | 29 | ||
30 | #define CN_W1_IDX 3 | ||
31 | #define CN_W1_VAL 1 | ||
32 | |||
29 | enum w1_netlink_message_types { | 33 | enum w1_netlink_message_types { |
30 | W1_SLAVE_ADD = 0, | 34 | W1_SLAVE_ADD = 0, |
31 | W1_SLAVE_REMOVE, | 35 | W1_SLAVE_REMOVE, |
32 | W1_MASTER_ADD, | 36 | W1_MASTER_ADD, |
33 | W1_MASTER_REMOVE, | 37 | W1_MASTER_REMOVE, |
38 | W1_MASTER_CMD, | ||
39 | W1_SLAVE_CMD, | ||
34 | }; | 40 | }; |
35 | 41 | ||
36 | struct w1_netlink_msg | 42 | struct w1_netlink_msg |
37 | { | 43 | { |
38 | __u8 type; | 44 | __u8 type; |
39 | __u8 reserved[3]; | 45 | __u8 reserved; |
40 | union | 46 | __u16 len; |
41 | { | 47 | union { |
42 | struct w1_reg_num id; | 48 | __u8 id[8]; |
43 | __u64 w1_id; | 49 | struct w1_mst { |
44 | struct | ||
45 | { | ||
46 | __u32 id; | 50 | __u32 id; |
47 | __u32 pid; | 51 | __u32 res; |
48 | } mst; | 52 | } mst; |
49 | } id; | 53 | } id; |
54 | __u8 data[0]; | ||
55 | }; | ||
56 | |||
57 | #define W1_CMD_READ 0x0 | ||
58 | #define W1_CMD_WRITE 0x1 | ||
59 | #define W1_CMD_SEARCH 0x2 | ||
60 | #define W1_CMD_ALARM_SEARCH 0x3 | ||
61 | |||
62 | struct w1_netlink_cmd | ||
63 | { | ||
64 | __u8 cmd; | ||
65 | __u8 res; | ||
66 | __u16 len; | ||
67 | __u8 data[0]; | ||
50 | }; | 68 | }; |
51 | 69 | ||
52 | #ifdef __KERNEL__ | 70 | #ifdef __KERNEL__ |
53 | 71 | ||
54 | void w1_netlink_send(struct w1_master *, struct w1_netlink_msg *); | 72 | void w1_netlink_send(struct w1_master *, struct w1_netlink_msg *); |
55 | int dev_init_netlink(struct w1_master *dev); | 73 | int w1_init_netlink(void); |
56 | void dev_fini_netlink(struct w1_master *dev); | 74 | void w1_fini_netlink(void); |
57 | 75 | ||
58 | #endif /* __KERNEL__ */ | 76 | #endif /* __KERNEL__ */ |
59 | #endif /* __W1_NETLINK_H */ | 77 | #endif /* __W1_NETLINK_H */ |