我在Ubuntu20.04和Raspberry操作系统5.10上使用了它,但这不是Linux的问题。
当我使用一个名为Bettercap2( https://www.bettercap.org/和存储库:https://github.com/bettercap/bettercap )的程序用不同的蓝牙软盘扫描蓝牙设备"ble.recon on“时,我遇到了问题。
当我在使用Realtek RTL8761b驱动程序( MPOW MPBH456AB )的dongle上使用它时,您可以在亚马逊上发现它工作得很好,但是当我使用NordicSemi nrf52840 dongle ( https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle )(这是我的目标)时,闪现了Zephyr的hci_usb示例( usb ),它应该将任何使用蓝牙的微控制器转换成任何计算机应该识别的常规蓝牙dongle,这会引发这个错误:
>> ble.recon on
panic: runtime error: slice bounds out of range [:1] with capacity 0
goroutine 1 [running]:
github.com/bettercap/gatt/linux/cmd.(*Cmd).SendAndCheckResp(0x1c637c0, 0xa0c760, 0x1c64fe8, 0x1c6501c, 0x1, 0x1, 0x0, 0x0)
/home/pi/go/pkg/mod/github.com/bettercap/gatt@v0.0.0-20210514133428-df6e615f2f67/linux/cmd/cmd.go:98 +0x1b4
github.com/bettercap/gatt/linux.(*HCI).resetDevice(0x18ac0a0, 0x93dc10, 0x18ac0a0)
/home/pi/go/pkg/mod/github.com/bettercap/gatt@v0.0.0-20210514133428-df6e615f2f67/linux/hci.go:273 +0x2f0
github.com/bettercap/gatt/linux.NewHCI(0xffffffff, 0x184fd01, 0xff, 0x2, 0x0, 0x0)
/home/pi/go/pkg/mod/github.com/bettercap/gatt@v0.0.0-20210514133428-df6e615f2f67/linux/hci.go:90 +0x4c0
github.com/bettercap/gatt.NewDevice(0x184fd1c, 0x2, 0x2, 0x3c, 0x184fd24, 0x1, 0x1)
/home/pi/go/pkg/mod/github.com/bettercap/gatt@v0.0.0-20210514133428-df6e615f2f67/device_linux.go:57 +0x114
github.com/bettercap/bettercap/modules/ble.(*BLERecon).Configure(0x18a2780, 0x0, 0x4)
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/modules/ble/ble_recon.go:165 +0x1cc
github.com/bettercap/bettercap/modules/ble.(*BLERecon).Start(0x18a2780, 0x1, 0x1b2c001)
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/modules/ble/ble_recon.go:183 +0x1c
github.com/bettercap/bettercap/modules/ble.NewBLERecon.func1(0x0, 0x0, 0x0, 0x84f358, 0xc)
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/modules/ble/ble_recon.go:56 +0x1c
github.com/bettercap/bettercap/session.(*ModuleHandler).Exec(0x1b2c0c0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/session/module_handler.go:74 +0x80
github.com/bettercap/bettercap/session.(*Session).Run(0x18fb2c0, 0x1c64e30, 0xc, 0x1, 0x1)
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/session/session.go:416 +0x284
main.main()
/home/pi/go/pkg/mod/github.com/bettercap/bettercap@v2.24.1+incompatible/main.go:94 +0x8c8我不知道这意味着什么,因为我不是Go开发人员,也从未使用过这种语言,我看过错误,它似乎在代码中,但不知道Go,我更喜欢在修改任何东西之前询问。
问题只是当我使用nrf dongle时,否则它会与主机的蓝牙和另一个realtek dongle一起工作。
nrf dongle与BlueZ堆栈一起工作,以下是结果:
BD (有BD地址)扫描确实有效
$ sudo bluetoothctl
Agent registered
[bluetooth]# list
Controller EB:XX:XX:XX:XX:XX BlueZ 5.50 [default]btmgmt (找到控制器)扫描工作
$ sudo btmgmt --index 0
[hci0]# auto-power
Found controller with index 0
[hci0]# find -l但是,尽管不推荐,但hciconfig和hcitool承认realtek dongle,但对于这一个,结果如下:
(无BD地址)
$ hciconfig
hci0: Type: Primary Bus: USB
BD Address: 00:00:00:00:00:00 ACL MTU: 27:7 SCO MTU: 0:0
UP RUNNING
RX bytes:1593 acl:0 sco:0 events:88 errors:0
TX bytes:285 acl:0 sco:0 commands:51 errors:0hcitool (找不到控制器)
$ hcitool scan
Scanning ...
Inquiry failed: Operation not supported因此,我假设dongle在BlueZ中运行良好,作为Linux官方蓝牙堆栈,这是一个很好的迹象,但我认为Bettercap也在使用BlueZ,从这个意义上说,dongle应该能工作。
我不认为有任何驱动程序来安装的dongle,因为事实上,当它是闪烁(J-链接),它变成一个通用的蓝牙dongle。
你知道会有什么问题吗?
发布于 2021-09-10 10:44:32
我相信这个错误来自于https://github.com/bettercap/gatt/blob/master/linux/cmd/cmd.go#L98
该程序正在尝试向设备写入某些内容,并希望只要没有发送错误,它就会收到响应。但是很明显,发送电话是成功的,但收到了一个空的响应。
我建议打开一个问题在那边并问你的问题。
https://stackoverflow.com/questions/69059990
复制相似问题