Skip to contentSkip to conversation

tty events for usbserial not sent during boot

DISCUSSION Thomas Stewart 2 participants 2 messages Oct 2, 2006 – Oct 3, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I want to run a script each time a usb serial device is connected to my pc. I want this script to run for both 1) usb serial devices that are found during boot and 2) any other usb serial device that is connected after boot up. The script will run minicom inside a screen session (eventually). The problem is I can't get the script to run for devices found during bootup.

So I created a new rules file, /etc/udev/rules.d/ttyUSB.rules:
ACTION="add" SUBSYSTEM="tty" ENV{PHYSDEVBUS}="usb-serial" RUN+="/etc/udev/ttyUSB"

With a simple /etc/udev/ttyUSB to start with:
#!/bin/bash
echo "ttyUSB: date $ACTION,$SUBSYSTEM,$PHYSDEVBUS,$DEVPATH,$DEVNAME"

When I boot with a usb serial device attached, it appears that the above script never runs. If I boot without a usb serial device attached and I wait for the system to get to login and then attach it, then it runs the script as expected.

I set /etc/udev/udev.conf:udev_log to info. After booting with the device attached, I examined syslog and found no mention of /etc/udev/ttyUSB at all. There was only 1 entry that had ttyUSB in, which looks like output from the module when its loaded:

Oct  2 17:41:07 lilt kernel: usb 2-1.2: MCT U232 converter now attached

to ttyUSB0

I rebooted with the device unplugged and waited till I could login. I attached the device and then looked at syslog, which had several mentions of /etc/udev/ttyUSB and ttyUSB0:

Oct  2 17:44:37 lilt udevd-event[6337]: udev_rules_get_name: no node name set, will use kernel name 'ttyUSB0'
Oct  2 17:44:37 lilt udevd-event[6337]: udev_db_get_device: no db file to read /dev/.udev/db/class@tty@ttyUSB0: No such file or directory
Oct  2 17:44:37 lilt udevd-event[6337]: udev_node_add: creating device node '/dev/ttyUSB0', major = '188', minor = '0', mode = '0660', uid = '0', gid = '20'
Oct  2 17:44:37 lilt udevd-event[6337]: run_program: '/etc/udev/ttyUSB'
Oct  2 17:44:37 lilt udevd-event[6337]: run_program: '/etc/udev/ttyUSB' (stdout) 'ttyUSB: Mon Oct  2 17:44:37 BST 2006 add,tty,usb-serial,/class/tty/ttyUSB0,/dev/ttyUSB0'
Oct  2 17:44:37 lilt udevd-event[6337]: run_program: '/etc/udev/ttyUSB' returned with status 0

My question is, how to I get the script to run on devices during boot and on devices found afterword?

(As a side note, running udevtrigger manually in both situations, the script runs)

My test system is a new install of Debian Sid, upgraded to the latest packages on 2/10/06. It's running linux-2.6.17-2-486 and udev-0.100-2.

(Can you please cc me as I am not on the list)

Regards
--
Tom

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 9 lines · Thomas Stewart

My question is, how to I get the script to run on devices during boot and on devices found afterword?

(As a side note, running udevtrigger manually in both situations, the script runs)

My test system is a new install of Debian Sid, upgraded to the latest packages on 2/10/06. It's running linux-2.6.17-2-486 and udev-0.100-2.

If it runs when udevtrigger is run, it sounds like it could be something to do with the debian startup scripts not triggering events properly. Do you know how they trigger udev events at bootup?

Alex :-)

Signature · 3 lines
Pippin
Computer Monkey to the Pelican
www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel