SOLARMA / nxt-control-mmf

Control your LEGO Mindstorm NXT for the Torino Mini Maker Faire
MIT License
1 stars 2 forks source link

Try "nxt_test --debug" using Bluetooth #8

Open gmacario opened 6 years ago

gmacario commented 6 years ago

Note: To be tested on rpi3gm28 (rpi3gm26 does not have proper RFCOMM support - see https://github.com/SOLARMA/nxt-control-mmf/issues/3#issuecomment-392969735)

gmacario commented 6 years ago

Trynxt_test --debug without connecting USB cable.

Also, confirm BT pairing PIN on the Mindstorms display when requested:

.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $ nxt_test --debug
debug = True
Find brick...
Host: 00:16:53:05:15:50 Name: NXT Strict: True
USB: True BT: True
...
Traceback (most recent call last):
  File "/home/pi/github/SOLARMA/nxt-control-mmf/.venv/lib/python3.5/site-package
s/nxt/locator.py", line 121, in find_one_brick
    b = s.connect()
  File "/home/pi/github/SOLARMA/nxt-control-mmf/.venv/lib/python3.5/site-package
s/nxt/bluesock.py", line 40, in connect
    sock.connect((self.host, BlueSock.PORT))
  File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: (13, 'Permission denied')
Failed to connect to possible brick
No brick was found.
    Is the brick turned on?
    For more diagnosing use the debug=True argument or
    try the 'nxt_test' script located in /bin or ~/.local/bin
Error while running test:
  File "/home/pi/github/SOLARMA/nxt-control-mmf/.venv/src/nxt-python/scripts/nxt
_test", line 27, in <module>
    b = nxt.locator.find_one_brick(debug=debug)
  File "/home/pi/github/SOLARMA/nxt-control-mmf/.venv/lib/python3.5/site-package
s/nxt/locator.py", line 162, in find_one_brick
    raise BrickNotFoundError

(.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $
gmacario commented 6 years ago

Reference: https://stackoverflow.com/questions/34599703/rfcomm-bluetooth-permission-denied-error-raspberry-pi

Double check whether your pi user is in the bluetooth group:

.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $ grep bluetooth /etc/group
bluetooth:x:111:
(.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $ 

If not, add pi to the bluetooth group:

(.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $ sudo usermod -G bluetooth
 -a pi
(.venv) pi@rpi3gm28:~/github/SOLARMA/nxt-control-mmf $ 

TODO: Change group of the /var/run/sdp file:

TODO