Lines Matching +full:feedback +full:- +full:pin

2 #-
3 # ----------------------------------------------------------------------------
4 # "THE BEER-WARE LICENSE" (Revision 42):
7 # this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp
8 # ----------------------------------------------------------------------------
13 exerr () { echo -e "Error: $*" >&2 ; exit 1; }
14 print_syntax () { echo -e "Syntax: $0 scan [-d device] [-n node]"; exit 1; }
20 [ "$#" -eq 1 -a "$1" = "scan" ] || print_syntax
33 if [ $( id -u ) -ne 0 ]; then
34 exerr "$0 must modify files that belong to root. Re-run as root."
38 /usr/bin/tail -n +2 | /usr/bin/cut -d ' ' -f 1 )
43 /usr/bin/grep -o "Name: .* Type: ubt" |/usr/bin/cut -d' ' -f2 )
63 read -p "${prompt}" node
68 # Re-read known nodes
70 /usr/bin/tail -n +2 | /usr/bin/cut -d ' ' -f 1 )
86 [ "${node}" ] && node="-n ${node}"
92 bdaddresses=$( /usr/sbin/hccontrol -N ${node} inquiry 2>/dev/null |
93 /usr/bin/grep -o "BD_ADDR: .*" | /usr/bin/cut -d ' ' -f 2 )
110 if ! [ "${found}" -o "${count}" -a -z "${device}" ]; then
112 if [ "${#retry}" -eq 5 ]; then
121 [ ${#count} -gt 1 ] && plural=s || plural=''
125 # Looping again for the faster feedback
129 bdname=$( /usr/bin/bthost -b "${bdaddress}" 2>/dev/null )
132 /usr/bin/grep -o "Name: .*" |/usr/bin/cut -d ' ' -f 2- )
143 # If a device was pre-selected, do not query the user
149 [ ${#count} -gt 1 ] && prompt="${prompt}-${#count}"
150 read -p "${prompt}, or 0 to rescan]: " topair
151 if ! [ "${topair}" -ge 0 -a "${topair}" -le "${#count}" ] \
158 [ "${topair}" -eq "0" ] && unset bdaddresses retry
170 read -p "Enter friendly name. [${friendlyname}]: " _r
174 # Remove white space and non-friendly characters
175 bdname=$( printf "%s" "${_r}" | tr -c '[:alnum:]-,.' _ )
195 # Also we cannot really modify the PIN in an existing entry. So we
200 read -p "Enable hcsecd? [yes]: " _r
207 secd_config=$( /usr/sbin/sysrc -n hcsecd_config )
208 secd_entries=$( /usr/bin/grep -Eo "bdaddr[[:space:]]+(${bdaddress}|${bdname})" \
216 read -p "Continue? [yes]: " _r
221 printf "(To get PIN, put device in pairing mode first.)\n"
222 read -p "Enter PIN [nopin]: " pin
223 [ "${pin}" ] && pin=\""${pin}"\" || pin="nopin"
227 "${bdaddress}" "${friendlyname}" "${pin}" >> ${secd_config}
235 # retry with a new PIN
236 # also, if there's a way to force devices to re-pair, try this
242 /usr/sbin/sdpcontrol -a "${bdaddress}" search HID | \
243 /usr/bin/grep -q "^Record Handle: " || exit 0
246 read -p "Set it up? [yes]: " _r
258 read -p "Enable bthidd? [yes]: " _r
266 bthidd_known=$( /usr/sbin/bthidcontrol -a "${bdaddress}" known | \
274 bthidd_config=$( /usr/sbin/sysrc -n bthidd_config )
276 /usr/sbin/bthidcontrol -a "${bdaddress}" query >> "${bthidd_config}"
278 # Re-read config to see if we succeeded adding the device
279 bthidd_known=$( /usr/sbin/bthidcontrol -a "${bdaddress}" known | \
284 printf "success.\nTo re-read its config, bthidd must be restarted.\n"
289 read -p "Restart bthidd now? [yes]: " _r