Closed mgrouch closed 2 months ago
had the same problem, in my case ttyUSB0 is an USB-> serial -> EnOcean device. Please update your driver to check first and not just hardcode the port.
deskpi-config
has this at line 14 (just like it is hard coded in line 16 of pwmControlFan.c
):
serial_port='/dev/ttyUSB0'
I dont have any other USB TTY devices, so someone else will have to do some testing and /sys/class/
lookups to see where the DeskPi TTY device ends up when you have another USB TTY device plugged in
HINT:
on RPi the USB devices are assigned from top-down, left -to-right , which corresponds to there USB ID numbers (lowest to highest). /dev/ttyUSB0
only gets assigned to the DeskPi if no other USB TTY devices have already been registered with the stack.
/dev/ttyUSB0
before the DeskPi , which means the DeskPi will have /dev/ttyUSB1
./dev/ttyUSB1
and DeskPi will still be on /dev/ttyUSB0
/dev/ttyUSB?
deviceNOTE: this does not take into account the front USB ports either, which is why some testing is needed. Also it might be possible to get (instead of put only) a value to the DeskPi USB TTY device, and get a known response back (eg like requesting the current PWM % maybe?), in which case you could blindly poll all the USB TTY devices , as long as you know what you are looking for per device.
@yoyojacky possible solution, use udev rules.
In this case within your install script:
#!/bin/bash
# create a udev rule for serial communication
UDEVRULE="ACTION==\"add\", ATTRS{idVendor}==\"1d6b\", ATTRS{idProduct}==\"0002\", SYMLINK+=\"deskPiPro\""
if [ ! -f /etc/udev/rules.d/10-local.rules ]; then
echo -e $UDEVRULE >> /etc/udev/rules.d/10-local.rules
else
checkResult=`grep "$UDEVRULE" /etc/udev/rules.d/10-local.rules`
if [ $? -ne 0 ]; then
echo -e $UDEVRULE >> /etc/udev/rules.d/10-local.rules
fi
fi
The system will atomically create a symlink /dev/deskPiPro
as soon as it finds a USB device with matching idVendor && idProduct. Now you can talk to the device by serialport serial_port='/dev/deskPiPro'
yes, udev rule is better, I will try it on my test device, and update the script.
@f-io I've tried this, but and adding a udev rule file to /etc/udev/rules.d/10-deskpi.rules
and it can generate a symbolic link to /dev/ttyUSB0, like aliase name, but once I am trying to operate this device : /dev/deskPiPro
it will not work properly.
for example : echo "pwm_100" > /dev/deskPiPro
it will not trigger the fan spinning, but if i send the same command to /dev/ttyUSB0, it works fine .
and i have change the owner of the /dev/deskPiPro to current user by using chown command and chmod command .
had the same problem, in my case ttyUSB0 is an USB-> serial -> EnOcean device. Please update your driver to check first and not just hardcode the port.
Did you connect other USB device on your raspberry pi or just deskpi pro?
ttyUSB0 is FTDI USB to serial adapter which has nothing to do with deskpi pro! Absolutely unrelated device.