system
January 23, 2009, 7:38pm
1
I have issue with phpSerial class and Arduino 10k.
Every time I connect Arduino usb to my pc, I have to set up 777 permission to /dev/ttyUSB0
chmod 777 /dev/ttyUSB0
Otherwhise phpSerial can't access to device.
Is there a way to make permanent this chmod?
Thanks in advamce
system
January 23, 2009, 9:47pm
2
Hi,
Look at the output of ls -l /dev/ttyUSB0
, and add the user running your web server to the group who owns this device.
For example on my machine:
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 2009-01-23 16:29 /dev/ttyUSB0
owner group: dialout. So now I look at:
$ ps aux | grep apache
www-data 803 0.0 0.2 204220 4244 ? S Jan21 0:00 /usr/sbin/apache2 -k start
the user www-data
runs my Apache:
$ adduser www-data dialout
Regards, Peter.
system
January 23, 2009, 10:14pm
3
done, nothing to do got a bunch of error:
Warning: Specified serial port is not valid in /home/frank/public_html/php_serial.class.php on line 111
Warning: The device must be set before to be open in /home/frank/public_html/php_serial.class.php on line 137
Warning: Device must be opened in /home/frank/public_html/php_serial.class.php on line 541
Warning: Device must be opened to read it in /home/frank/public_html/php_serial.class.php on line 474
0
Warning: Device must be opened in /home/frank/public_html/php_serial.class.php on line 541
Warning: Device must be opened to read it in /home/frank/public_html/php_serial.class.php on line 474
0
Warning: Device must be opened in /home/frank/public_html/php_serial.class.php on line 541
Warning: Device must be opened to read it in /home/frank/public_html/php_serial.class.php on line 474
0
Warning: Device must be opened in /home/frank/public_html/php_serial.class.php on line 541
Warning: Device must be opened to read it in /home/frank/public_html/php_serial.class.php on line 474
0
Warning: Device must be opened in /home/frank/public_html/php_serial.class.php on line 541
Warning: Device must be opened to read it in /home/frank/public_html/php_serial.class.php on line 474
system
January 25, 2009, 12:23am
4
Variation on a theme
http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/
usermod -a -G groupiwant usertoadditto
usermod -a -G dialout www-data
Change the permissions back to something appropriate. The script may need permissions and ownership set as well. I do not recall if Apache sets a scripts permissions to what the script has (within limits) or what Apache runs at.
system
January 25, 2009, 4:33pm
5
it works! tnks...
still remains issue of first null samples..but i think it's caused by autoreset that I have to disable...(DTR to off or hardware mod)
thanks again