diff options
author | Felipe Zimmerle <felipe.zimmerle@indt.org.br> | 2008-09-17 11:34:42 -0400 |
---|---|---|
committer | David Vrabel <dv02@dv02pc01.europe.root.pri> | 2008-09-17 11:54:35 -0400 |
commit | f1fa035f2bcb2b03cb90249e05ec2ae6927a7302 (patch) | |
tree | 410e7355c919c8c9384b9a3db497f83ca46170a9 /Documentation/usb/wusb-cbaf | |
parent | c8cf2465fcfc16877f4f9e8dccc6b89b543fa2c5 (diff) |
wusb: wusb-cbaf (CBA driver) sysfs ABI simplification
Simplify the sysfs ABI of the wusb-cbaf (Cable Based Association)
driver: use one value per file and cause the write of the CHID to
fetch the CDID (instead of requiring a separate read).
Update the example wusb-cbaf script to work with this revised ABI.
Signed-off-by: Felipe Zimmerle <felipe.zimmerle@indt.org.br>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'Documentation/usb/wusb-cbaf')
-rw-r--r-- | Documentation/usb/wusb-cbaf | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/Documentation/usb/wusb-cbaf b/Documentation/usb/wusb-cbaf index a385478ba12e..2e78b70f3adc 100644 --- a/Documentation/usb/wusb-cbaf +++ b/Documentation/usb/wusb-cbaf | |||
@@ -70,32 +70,42 @@ EOF | |||
70 | # FIXME: CHID should come from a database :), band group from the host | 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" | 71 | host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff" |
72 | host_band_group="0001" | 72 | host_band_group="0001" |
73 | host_name="Linux-WUSB" | 73 | host_name=$(hostname) |
74 | 74 | ||
75 | devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)" | 75 | devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)" |
76 | hdevs="$(find /sys -name wusb_chid -printf "%h\n")" | 76 | hdevs="$(for h in /sys/class/uwb_rc/*/wusbhc; do readlink -f $h; done)" |
77 | 77 | ||
78 | result=0 | 78 | result=0 |
79 | case $1 in | 79 | case $1 in |
80 | start) | 80 | start) |
81 | for dev in ${2:-$hdevs} | 81 | for dev in ${2:-$hdevs} |
82 | do | 82 | do |
83 | uwb_rc=$(find $(dirname $(dirname $dev)) -iname uwb_rc:uwb*) | 83 | uwb_rc=$(readlink -f $dev/uwb_rc) |
84 | if cat $uwb_rc/uwb_rc/beacon | grep -q "channel: -1" | 84 | if cat $uwb_rc/beacon | grep -q -- "-1" |
85 | then | 85 | then |
86 | echo 13 0 | cat > $uwb_rc/uwb_rc/beacon | 86 | echo 13 0 > $uwb_rc/beacon |
87 | echo I: started beaconing on ch 13 in host $(basename $uwb_rc) | 87 | echo I: started beaconing on ch 13 on $(basename $uwb_rc) >&2 |
88 | fi | 88 | fi |
89 | echo $host_CHID | cat > $dev/wusb_chid | 89 | echo $host_CHID > $dev/wusb_chid |
90 | echo I: started host $(basename $dev) | 90 | echo I: started host $(basename $dev) >&2 |
91 | done | ||
92 | ;; | ||
93 | stop) | ||
94 | for dev in ${2:-$hdevs} | ||
95 | do | ||
96 | echo 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > $dev/wusb_chid | ||
97 | echo I: stopped host $(basename $dev) >&2 | ||
98 | uwb_rc=$(readlink -f $dev/uwb_rc) | ||
99 | echo -1 | cat > $uwb_rc/beacon | ||
100 | echo I: stopped beaconing on $(basename $uwb_rc) >&2 | ||
91 | done | 101 | done |
92 | ;; | 102 | ;; |
93 | set-chid) | 103 | set-chid) |
94 | shift | 104 | shift |
95 | for dev in ${2:-$devs} | 105 | for dev in ${2:-$devs}; do |
96 | do | 106 | echo "${4:-$host_name}" > $dev/wusb_host_name |
97 | echo "${2:-$host_CHID}" "${3:-$host_band_group}" "${4:-$host_name}" \ | 107 | echo "${3:-$host_band_group}" > $dev/wusb_host_band_groups |
98 | | cat > $dev/wusb_host_info | 108 | echo ${2:-$host_CHID} > $dev/wusb_chid |
99 | done | 109 | done |
100 | ;; | 110 | ;; |
101 | get-cdid) | 111 | get-cdid) |
@@ -105,21 +115,17 @@ case $1 in | |||
105 | done | 115 | done |
106 | ;; | 116 | ;; |
107 | set-cc) | 117 | set-cc) |
108 | for dev in ${2:-$devs} | 118 | for dev in ${2:-$devs}; do |
109 | do | 119 | shift |
110 | shift | 120 | CDID="$(head --bytes=16 /dev/urandom | od -tx1 -An)" |
111 | CDID="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | 121 | CK="$(head --bytes=16 /dev/urandom | od -tx1 -An)" |
112 | CK="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | 122 | echo "$CDID" > $dev/wusb_cdid |
113 | cat > $dev/wusb_cc <<EOF | 123 | echo "$CK" > $dev/wusb_ck |
114 | CDID:$CDID | 124 | |
115 | CK:$CK | 125 | echo I: CC set >&2 |
116 | EOF | 126 | echo "CHID: $(cat $dev/wusb_chid)" |
117 | cat <<EOF | 127 | echo "CDID:$CDID" |
118 | I: CC set | 128 | echo "CK: $CK" |
119 | CHID: $host_CHID | ||
120 | CDID:$CDID | ||
121 | CK: $CK | ||
122 | EOF | ||
123 | done | 129 | done |
124 | ;; | 130 | ;; |
125 | help|h|--help|-h) | 131 | help|h|--help|-h) |