diff options
author | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | 2008-09-17 11:34:04 -0400 |
---|---|---|
committer | David Vrabel <dv02@dv02pc01.europe.root.pri> | 2008-09-17 11:54:23 -0400 |
commit | 99d368bc9e279a2a5e56f3afe32166260e90caa7 (patch) | |
tree | 44f73064afa9929f09cd2613e4e4cb737fb62b0f /Documentation/usb/wusb-cbaf | |
parent | ccbe329bcd87924baed96474ec0a6725e3957897 (diff) |
uwb: add initial documentation
Documentation (and example utilities) for the UWB (and WUSB) stacks.
Some of the documentation may be out-of-date.
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'Documentation/usb/wusb-cbaf')
-rw-r--r-- | Documentation/usb/wusb-cbaf | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/Documentation/usb/wusb-cbaf b/Documentation/usb/wusb-cbaf new file mode 100644 index 000000000000..a385478ba12e --- /dev/null +++ b/Documentation/usb/wusb-cbaf | |||
@@ -0,0 +1,133 @@ | |||
1 | #! /bin/bash | ||
2 | # | ||
3 | |||
4 | set -e | ||
5 | |||
6 | progname=$(basename $0) | ||
7 | function help | ||
8 | { | ||
9 | cat <<EOF | ||
10 | Usage: $progname COMMAND DEVICEs [ARGS] | ||
11 | |||
12 | Command for manipulating the pairing/authentication credentials of a | ||
13 | Wireless USB device that supports wired-mode Cable-Based-Association. | ||
14 | |||
15 | Works in conjunction with the wusb-cba.ko driver from http://linuxuwb.org. | ||
16 | |||
17 | |||
18 | DEVICE | ||
19 | |||
20 | sysfs path to the device to authenticate; for example, both this | ||
21 | guys are the same: | ||
22 | |||
23 | /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4.4/1-4.4:1.1 | ||
24 | /sys/bus/usb/drivers/wusb-cbaf/1-4.4:1.1 | ||
25 | |||
26 | COMMAND/ARGS are | ||
27 | |||
28 | start | ||
29 | |||
30 | Start a WUSB host controller (by setting up a CHID) | ||
31 | |||
32 | set-chid DEVICE HOST-CHID HOST-BANDGROUP HOST-NAME | ||
33 | |||
34 | Sets host information in the device; after this you can call the | ||
35 | get-cdid to see how does this device report itself to us. | ||
36 | |||
37 | get-cdid DEVICE | ||
38 | |||
39 | Get the device ID associated to the HOST-CHDI we sent with | ||
40 | 'set-chid'. We might not know about it. | ||
41 | |||
42 | set-cc DEVICE | ||
43 | |||
44 | If we allow the device to connect, set a random new CDID and CK | ||
45 | (connection key). Device saves them for the next time it wants to | ||
46 | connect wireless. We save them for that next time also so we can | ||
47 | authenticate the device (when we see the CDID he uses to id | ||
48 | itself) and the CK to crypto talk to it. | ||
49 | |||
50 | CHID is always 16 hex bytes in 'XX YY ZZ...' form | ||
51 | BANDGROUP is almost always 0001 | ||
52 | |||
53 | Examples: | ||
54 | |||
55 | You can default most arguments to '' to get a sane value: | ||
56 | |||
57 | $ $progname set-chid '' '' '' "My host name" | ||
58 | |||
59 | A full sequence: | ||
60 | |||
61 | $ $progname set-chid '' '' '' "My host name" | ||
62 | $ $progname get-cdid '' | ||
63 | $ $progname set-cc '' | ||
64 | |||
65 | EOF | ||
66 | } | ||
67 | |||
68 | |||
69 | # Defaults | ||
70 | # FIXME: CHID should come from a database :), band group from the host | ||
71 | host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff" | ||
72 | host_band_group="0001" | ||
73 | host_name="Linux-WUSB" | ||
74 | |||
75 | devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)" | ||
76 | hdevs="$(find /sys -name wusb_chid -printf "%h\n")" | ||
77 | |||
78 | result=0 | ||
79 | case $1 in | ||
80 | start) | ||
81 | for dev in ${2:-$hdevs} | ||
82 | do | ||
83 | uwb_rc=$(find $(dirname $(dirname $dev)) -iname uwb_rc:uwb*) | ||
84 | if cat $uwb_rc/uwb_rc/beacon | grep -q "channel: -1" | ||
85 | then | ||
86 | echo 13 0 | cat > $uwb_rc/uwb_rc/beacon | ||
87 | echo I: started beaconing on ch 13 in host $(basename $uwb_rc) | ||
88 | fi | ||
89 | echo $host_CHID | cat > $dev/wusb_chid | ||
90 | echo I: started host $(basename $dev) | ||
91 | done | ||
92 | ;; | ||
93 | set-chid) | ||
94 | shift | ||
95 | for dev in ${2:-$devs} | ||
96 | do | ||
97 | echo "${2:-$host_CHID}" "${3:-$host_band_group}" "${4:-$host_name}" \ | ||
98 | | cat > $dev/wusb_host_info | ||
99 | done | ||
100 | ;; | ||
101 | get-cdid) | ||
102 | for dev in ${2:-$devs} | ||
103 | do | ||
104 | cat $dev/wusb_cdid | ||
105 | done | ||
106 | ;; | ||
107 | set-cc) | ||
108 | for dev in ${2:-$devs} | ||
109 | do | ||
110 | shift | ||
111 | CDID="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | ||
112 | CK="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | ||
113 | cat > $dev/wusb_cc <<EOF | ||
114 | CDID:$CDID | ||
115 | CK:$CK | ||
116 | EOF | ||
117 | cat <<EOF | ||
118 | I: CC set | ||
119 | CHID: $host_CHID | ||
120 | CDID:$CDID | ||
121 | CK: $CK | ||
122 | EOF | ||
123 | done | ||
124 | ;; | ||
125 | help|h|--help|-h) | ||
126 | help | ||
127 | ;; | ||
128 | *) | ||
129 | echo "E: Unknown usage" 1>&2 | ||
130 | help 1>&2 | ||
131 | result=1 | ||
132 | esac | ||
133 | exit $result | ||