Difference between revisions of "Creation of special Kernel event handling (USB auto connection for serial communication)"

From Lofaro Lab Wiki
Jump to: navigation, search
(Created page with "Creation of special Kernel event handling (USB auto connection for serial communication) This will enable a user to connect a USB to serial device to their computer and auto...")
 
Line 1: Line 1:
Creation of special Kernel event handling (USB auto connection for serial communication)
+
Creation of special Kernel event handling ----
 +
USB auto connection for serial communication
 
This will enable a user to connect a USB to serial device to their computer and auto  
 
This will enable a user to connect a USB to serial device to their computer and auto  
 
generate the serial connection.
 
generate the serial connection.

Revision as of 00:13, 23 April 2015

Creation of special Kernel event handling ---- USB auto connection for serial communication This will enable a user to connect a USB to serial device to their computer and auto generate the serial connection.

~$sudo adduser [USERNAME] dialout ~$sudo touch /etc/udev/rules.d/95-serialdaemon.rules ~$sudo chmod +x /etc/udev/rules.d/95-serialdaemon.rules ~$sudo gedit /etc/udev/rules.d/95-serialdaemon.rules

Insert:

KERNEL=="ttyUSB0", ENV{SYSTEMD_WANTS}="serialdaemon.service"

Save and close file

~$sudo touch /lib/systemd/system/serialdaemon.service ~$sudo chmod +x /lib/systemd/system/serialdaemon.service ~$sudo gedit /lib/systemd/system/serialdaemon.service

Insert:

[Unit] Description=USB serial to socket bridge After=remote-fs.target After=syslog.target [Service] ExecStart=/mnt/serialdaemon.sh

Save and close file

~$sudo touch /mnt/serialdaemon.sh ~$sudo chmod +x /mnt/serialdaemon.sh ~$sudo gedit /mnt/serialdaemon.sh

Insert:

  1. !/bin/sh

date +%F-%T >> /var/log/serialdaemon.log /usr/local/serialdaemon/serialdaemon -serial /dev/ttyUSB0 -port 15789 -baud 9600 >> /var/log/serialdaemon.log 2>&1 date +%F-%T >> /var/log/serialdaemon.log

Save and close file

Restart Computer Upon restart plug in serial device and verify ~$stty < /dev/ttyUSB0