aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/usb/wusb-cbaf
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/usb/wusb-cbaf')
-rw-r--r--Documentation/usb/wusb-cbaf60
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
71host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff" 71host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"
72host_band_group="0001" 72host_band_group="0001"
73host_name="Linux-WUSB" 73host_name=$(hostname)
74 74
75devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)" 75devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)"
76hdevs="$(find /sys -name wusb_chid -printf "%h\n")" 76hdevs="$(for h in /sys/class/uwb_rc/*/wusbhc; do readlink -f $h; done)"
77 77
78result=0 78result=0
79case $1 in 79case $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
114CDID:$CDID 124
115CK:$CK 125 echo I: CC set >&2
116EOF 126 echo "CHID: $(cat $dev/wusb_chid)"
117 cat <<EOF 127 echo "CDID:$CDID"
118I: CC set 128 echo "CK: $CK"
119CHID: $host_CHID
120CDID:$CDID
121CK: $CK
122EOF
123 done 129 done
124 ;; 130 ;;
125 help|h|--help|-h) 131 help|h|--help|-h)