我有旧的 NeuroSky Mindwave 和 BrainLink_Lite 神经小工具,在这里我使用了 BrainLink。Neurosky 和 Brainlink 使用相同的协议以相同的方式工作,因为 BrainLink 使用了 NeuroSky 芯片 ( TGAM )。我按照下一条路解决了这个问题:
首先我得到:
$ dmesg | tail -n 50
....
[243709.823581] Bluetooth: hci0: BCM: chip id 63
[243709.839507] Bluetooth: hci0: ShisiusStation
[243709.840576] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[243709.840606] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-13d3-3404.hcd failed with error -2
[243709.840608] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-13d3-3404.hcd not found
...
通过blueman-manager连接后,我进入dmesg 输出:
[254803.943803] Bluetooth: TIOCGSERIAL is not supported
[254804.299425] Bluetooth: bad checksum in packet
[254817.417375] Bluetooth: TIOCGSERIAL is not supported
[254817.417498] Bluetooth: TIOCGSERIAL is not supported
[254823.416967] Bluetooth: TIOCGSERIAL is not supported
[254865.049149] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
没关系!顺便说一句,我无法通过以下方式连接到 BrainLink 大约 1-2 秒
bash$ sudo rfcomm connect /dev/rfcomm0 8C:DE:52:44:AB:23 1
我还修补了我的蓝牙设备错误(brcm/BCM20702A1-13d3-3404.hcd 的直接固件加载失败,错误 -2)在该文档链接之后(没有描述的模块重新编译)
wget https://www.dropbox.com/s/krg2ulkxdrqxham/bluetooth-hogfan.tar.gz
tar -zxvf bluetooth-hogfan.tar.gz
cd bluetooth
sudo cp fw-13d3_3404.hcd /lib/firmware/brcm
sudo cp fw-13d3_3404.hcd /lib/firmware/brcm/BCM20702A1-13d3-3404.hcd
sudo modprobe -r btusb
sudo modprobe btusb
结果,我可以使用通道 6(不是 1、2、3、4、5,...)连接 BT。我不知道为什么。
# in real rfcomm0 became rfcomm59 by the end of experimintations.
sudo rfcomm connect rfcomm0 8C:DE:52:44:AB:23 6
Connected /dev/rfcomm0 to 8C:DE:52:44:AB:23 on channel 6
Press CTRL-C for hangup
在另一个外壳中:
$: sudo cat /dev/rfcomm0 | hexdump -C
...
000f7f80 00 7b 02 aa aa 04 80 02 00 2c 51 aa aa 04 80 02 |.{.......,Q.....|
000f7f90 ff f9 85 aa aa 04 80 02 ff f9 85 aa aa 04 80 02 |................|
000f7fa0 00 44 39 aa aa 04 80 02 00 5b 22 aa aa 04 80 02 |.D9......[".....|
000f7fb0 00 31 4c aa aa 04 80 02 00 07 76 aa aa 04 80 02 |.1L.......v.....|
000f7fc0 ff ba c4 aa aa 04 80 02 ff 7e 00 aa aa 04 80 02 |.........~......|
000f7fd0 ff b3 cb aa aa 04 80 02 ff f9 85 aa aa 04 80 02 |................|
000f7fe0 00 1b 62 aa aa 04 80 02 00 45 38 aa aa 04 80 02 |..b......E8.....|
000f7ff0 00 36 47 aa aa 04 80 02 00 27 56 aa aa 04 80 02 |.6G......'V.....|
000f8000 00 66 17 aa aa 04 80 02 00 c5 b8 aa aa 04 80 02 |.f..............|
000f8010 00 e6 97 aa aa 04 80 02 00 91 ec aa aa 04 80 02 |................|
000f8020 ff f3 8b aa aa 04 80 02 ff d3 ab aa aa 04 80 02 |................|
000f8030 00 28 55 aa aa 04 80 02 00 36 47 aa aa 04 80 02 |.(U......6G.....|
...
数据含义的详细信息在此处、此处和此处进行了描述。有时它可以长时间正常工作,有时神经串行流会带来EOF,因此在断开连接后的一段时间内读取 /dev/rfcomm0 很有用。如果连接到通道 3,我得到:
sudo rfcomm connect rfcomm0 8C:DE:52:44:AB:23 3
Connected /dev/rfcomm43 to 8C:DE:52:44:AB:23 on channel 3
Press CTRL-C for hangup
# since 10 secs it is disconnect....
Disconnected
输出是:
$ sudo cat /dev/rfcomm43 | hexdump -C
00000000 55 04 00 38 00 00 c4 55 04 00 38 00 00 c4 55 04 |U..8...U..8...U.|
00000010 00 38 00 00 c4 55 04 00 38 00 00 c4 55 04 00 38 |.8...U..8...U..8|
...
000000a0 c4 55 04 00 38 00 00 c4 55 04 00 38 00 00 c4 |.U..8...U..8...|
000000af
# (and disconnect)
顺便说一句,我尝试运行NeuroPy 示例并且只得到了一次注意力测量:)。接下来我还要做:
sudo chmod 777 /dev/rfcomm0
sudo python neuropyexample.py
在所有描述的实验中,BrainLink 已从 blueman 配对设备中删除。我还在 TuSion via-Art 神经应用程序开发过程中进行了测试。这里是 Facebook社区组。我的最后一句话:
# Ubuntu 16.04
$ uname -a
Linux SlavikBoss 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux