首页 > 系统加固 > Other > 解决:hcitool lescan报错Operation not permitted
2018
07-13

解决:hcitool lescan报错Operation not permitted

使用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> $&gt; sudo apt-get install libcap2-bin
</code>

installs linux capabilities manipulation tools.

<code> $&gt; 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> $&gt; getcap !$
 getcap `which hcitool`
 /usr/bin/hcitool = cap_net_admin,cap_net_raw+eip
</code>

so we are good to go:

<code>$&gt;hcitool -i hci0 lescan
Set scan parameters failed: Input/output error
</code>

Yeay, your BT adapter does not support BLE

<code>$&gt;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

最后编辑:
作者:admin
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。