SOLARMA / nxt-control-mmf

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

nxt_beep.py: Figure out how to run as regular user #3

Open gmacario opened 6 years ago

gmacario commented 6 years ago

See https://github.com/SOLARMA/nxt-control-mmf/blob/master/docs/test-rpi3gm28.md

See also: #5

gmacario commented 6 years ago

After configuring udev as explained in https://github.com/SOLARMA/nxt-control-mmf/issues/5#issuecomment-392959978 command nxt_test can be run as non-root user.

Notice that nxt_test was only attempted using the USB link (not Bluetooth)

Let us now try with python nxt_beep.py

(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $ python nxt_beep.py 
Traceback (most recent call last):
  File "nxt_beep.py", line 17, in <module>
    brick = sock.connect()
  File "/home/pi/.nxt-venv/src/nxt-python/nxt/bluesock.py", line 39, in connect
    sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
  File "/home/pi/.nxt-venv/lib/python3.4/site-packages/bluetooth/bluez.py", line 155, in __init__
    _sock = _bt.btsocket (proto)
_bluetooth.error: (93, 'Protocol not supported')
(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $
gmacario commented 6 years ago

Command hcitool scan correctly identifies the NXT device

(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $ hcitool scan
Scanning ...
    C0:CB:38:CE:39:FC   dell-davi
    00:16:53:05:15:50   NXT
(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $

On the other hand, it looks like the distribution running on rpi3gm26 does not find the rfcomm kernel module

(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $ rfcomm 
Can't open RFCOMM control socket: Protocol not supported
(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $ sudo modprobe rfcomm
modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.50-v7+/modules.dep.bin'
(.nxt-venv) pi@rpi3gm26:~/github/SOLARMA/nxt-control-mmf $
gmacario commented 6 years ago

Notice that the Raspbian distribution installed on rpi3gm26 is TODO (used for the 3.5 LCD display)

(.nxt-venv) pi@rpi3gm26:~ $ uname -a
Linux rpi3gm26 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
(.nxt-venv) pi@rpi3gm26:~ $
(.nxt-venv) pi@rpi3gm26:~ $ ls -la /lib/modules
total 16
drwxr-xr-x  4 root root 4096 May 27 19:06 .
drwxr-xr-x 18 root root 4096 May 27 18:52 ..
drwxr-xr-x  3 root root 4096 May 27 19:06 4.9.35+
drwxr-xr-x  3 root root 4096 May 27 19:06 4.9.35-v7+
(.nxt-venv) pi@rpi3gm26:~ $