使用hcitool lescan命令扫描附近的BLE设备的时候,报错如下:
Set scan parameters failed:Operation not permitted
Google了一下,贴上解决方案,亲测有效:
The Bluetooth protocol stack for Linux checks two capabilities. Capabilities are a not yet common system to manage some privileges. They could be handled by a PAM module or via extended file attributes. (see http://lxr.free-electrons.com/source/net/bluetooth/hci_sock.c#L619)
<code> $> sudo apt-get install libcap2-bin </code>
installs linux capabilities manipulation tools.
<code> $> sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool` </code>
sets the missing capabilities on the executable quite like the setuid bit.
<code> $> getcap !$ getcap `which hcitool` /usr/bin/hcitool = cap_net_admin,cap_net_raw+eip </code>
so we are good to go:
<code>$>hcitool -i hci0 lescan Set scan parameters failed: Input/output error </code>
Yeay, your BT adapter does not support BLE
<code>$>hcitool -i hci1 lescan LE Scan... </code>
This one does, go on and press a button on your device.
原文链接:https://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root
- 本文固定链接: http://www.nxadmin.com/system/other/1710.html
- 转载请注明: admin 于 阿德马Web安全 发表