zen*_*ike 7 debian bluetooth raspberry-pi
因为我需要使用我的键盘来登录,我希望我的键盘对自动预登录。
我正在使用 Debian 挤压,并且是 linux 的新手。我发现的所有教程似乎都需要 HIDD 软件包,该软件包在当前的 Debian 版本中已被弃用(我认为)。
Apt-get install 返回在 repo 响应中找不到的包。
有没有人有办法解决这个问题?
如果重要的话,我在 Raspberry Pi 上使用 Debian Squeeze,以及一个 Apple 蓝牙键盘/Magic Trackpad。
我偶尔会使用以下脚本将蓝牙键盘添加到我的系统中,它在系统级别而不是用户级别添加它,这似乎使事情从引导开始工作,并且我的键盘可以从登录使用迅速的。
正如所写,您将需要 bash(希望 v4.0+)和bluez包,它提供bluez-simple-agent、bluez-test-device、bluez-test-input程序。
下面的大部分代码是实现一个列表来让你选择哪个设备,它实际上只是归结为最后 6 行(非注释),如果你知道你的 BT MAC 地址,你可以用静态赋值。
#!/bin/bash
#
# L Nix <lornix@lornix.com>
# setup-bt-kb : allow choosing & pairing a bluetooth keyboard from the console
#
declare -a addrlist
#
while [ 1 ]; do
echo -n "Scanning for Bluetooth devices ... "
readarray -n 10 -O 0 -t addrlist < <(hcitool scan|grep -v "^Scanning"|sed -e "s/^[ \t]//g" -e "s/\t/ /g" | head -n 9)
echo
echo
length=${#addrlist[@]}
a=1
while [ ${a} -le ${length} ]; do
echo "$a) ${addrlist[$a-1]}"
a=$((a + 1))
done
echo
while [ 1 ]; do
if [ ${length} -gt 0 ]; then
echo -n "Choose (1-${length}), or "
fi
echo -n "'R' to rescan: "
read -n 1 REPLY
echo
case ${REPLY} in
Q)
# just quit
exit 0
;;
[0rR])
echo
REPLY=0
break
;;
[123456789])
if [ ${REPLY} -le ${length} ]; then
echo "Got ${REPLY}"
break
fi
;;
*)
;;
esac
done
if [ ${REPLY} -gt 0 ]; then
break
fi
done
#
device=${addrlist[${REPLY}-1]}
#
BTADDR=${device/% *}
BTNAME=${device/#??:??:??:??:??:?? }
#
echo "selecting '${BTNAME}' at ${BTADDR}"
#
echo "Pairing with ${BTNAME} (Generally '0000')"
bluez-simple-agent hci0 ${BTADDR}
#
echo "Setting trust level with ${BTNAME}"
bluez-test-device trusted ${BTADDR} yes
#
echo "Connecting to ${BTNAME}"
bluez-test-input connect ${BTADDR}
#
echo "Completed"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11759 次 |
| 最近记录: |