...
For NPE X500 the protocol supports reading of digital and analog inputs and status of user button, writing to digital outputs, setting relay outputs, working with user LEDs and a buzzer.
Note: On Raspberry PI, the KOM process must be run under the root user to gain access to the GPIO. It is possible to achieve by setting the setuid bit for the kom binary. Under the user pi, you can do the following:
cd /opt/d2000/bin
sudo chown root kom
sudo chmod 4755 kom
Note: On NPE X500, the KOM process must be run under the root user to gain access to the GPIO (see the previous note for Raspberry PI). An alternative is adding user d2000 to groups and setting appropriate access rights. Under the root user, you can do the following:
sudo usermod -a -G gpio d2000
For access to serial ports also:
sudo usermod -a -G dialout d2000
In order for the d2000 user to access the LEDs and the buzzer, it is necessary to set the rights for the respective files each time the computer starts up. Create a file d2000init in the /etc/init.d directory containing:
#!/bin/bash
### BEGIN INIT INFO
# Provides: script
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: D2000Kom
# Description: Support for D2000 KOM (work with leds/buzzer)
### END INIT INFO
DESC="Set permissions for LED/BUZZER for D2000 KOM"
chmod -R o+w /sys/class/leds/LED1
chmod -R o+w /sys/class/leds/LED2
chmod -R o+w /sys/class/leds/BUZZER
Then run:
chmod 755 /etc/init.d/d2000init
update-rc.d d2000init defaults
Kotva | ||||
---|---|---|---|---|
|
...