From: <pa...@rc...> - 2001-06-12 09:31:51
|
Allen Barnett wrote: > [Back from a great trip to Bryce and Zion National Parks. Highly > reccommended! But wear a hat and use lots of sunscreen.] Hi, Allen. Welcome back! I really should get out more often as well, but lately I've been too busy working on this project to have much of a life. :-) > > 2. ptal-mlcd and ptal-printd now log to syslog in addition to standard output > > or standard error, respectively. > > Seems to work. When the commands start and run OK, there doesn't seem to > be any output! A test with bad command line arguments did put a line in > /var/log/messages. Maybe each of the ptal- commands could put a "banner" > line out to syslog on startup? Good point. It would probably be useful to log other interesting events as well, such as activation attempts. It's on my TODO list. > Rapidly pulled and inserted the USB plug 3 times and got these messages > in /var/log/messages: > > Jun 11 11:06:21 guanaco kernel: usb.c: USB disconnect on device 5 > Jun 11 11:06:22 guanaco ptal-mlcd: ptal-mlcd: ERROR at ExMgr.cpp:2182, > dev=<usb:0>, pid=3879, errno=19 > Jun 11 11:06:22 guanaco ptal-mlcd: llioService: llioRead returns -1, > expected=6! > Jun 11 11:06:22 guanaco ptal-mlcd: ptal-mlcd: ERROR at ExMgr.cpp:888, > dev=<usb:0>, pid=3879, errno=25 > Jun 11 11:06:22 guanaco ptal-mlcd: exClose(reason=0x0010) > Jun 11 11:06:23 guanaco kernel: hub.c: USB new device connect on bus1/1, > assigned device number 6 > Jun 11 11:06:23 guanaco ptal-mlcd: ptal-mlcd: ERROR at ExMgr.cpp:2095, > dev=<usb:0>, pid=3879, errno=19 > Jun 11 11:06:23 guanaco ptal-mlcd: llioOpen: open failed! > Jun 11 11:06:23 guanaco ptal-mlcd: ptal-mlcd: FATAL ERROR at > ExMgr.cpp:793, dev=<usb:0>, pid=3879, errno=19 > Jun 11 11:06:23 guanaco ptal-mlcd: exActivate: Exiting due to activation > failure. > Jun 11 11:06:23 guanaco kernel: printer.c: usblp0: USB Bidirectional > printer dev 6 if 0 alt 0 > Jun 11 11:06:24 guanaco kernel: usb.c: USB disconnect on device 6 > Jun 11 11:06:24 guanaco ptal-mlcd: ptal-mlcd: ERROR at ExMgr.cpp:2095, > dev=<usb:0>, pid=4902, errno=19 > Jun 11 11:06:24 guanaco ptal-mlcd: llioOpen: open failed! > Jun 11 11:06:24 guanaco ptal-mlcd: ptal-mlcd: FATAL ERROR at > ExMgr.cpp:793, dev=<usb:0>, pid=4902, errno=25 > Jun 11 11:06:24 guanaco ptal-mlcd: exActivate: Exiting due to activation > failure. > Jun 11 11:06:24 guanaco kernel: hub.c: USB new device connect on bus1/1, > assigned device number 7 > Jun 11 11:06:24 guanaco kernel: printer.c: usblp0: USB Bidirectional > printer dev 7 if 0 alt 0 > Jun 11 11:06:25 guanaco kernel: usb.c: USB disconnect on device 7 > Jun 11 11:06:26 guanaco ptal-mlcd: ptal-mlcd: ERROR at ExMgr.cpp:2095, > dev=<usb:0>, pid=4941, errno=19 > Jun 11 11:06:26 guanaco ptal-mlcd: llioOpen: open failed! > Jun 11 11:06:26 guanaco ptal-mlcd: ptal-mlcd: FATAL ERROR at > ExMgr.cpp:793, dev=<usb:0>, pid=4941, errno=25 > Jun 11 11:06:26 guanaco ptal-mlcd: exActivate: Exiting due to activation > failure. > Jun 11 11:06:26 guanaco kernel: hub.c: USB new device connect on bus1/1, > assigned device number 8 > Jun 11 11:06:27 guanaco kernel: printer.c: usblp0: USB Bidirectional > printer dev 8 if 0 alt 0 > > Is this correct? There was only one instance of ptal-mlcd running after > all of that It looks OK to me, but the "startup message" you requested would indeed make it easier to read. Were you able to successfully use the device afterwards? Note that ptal-mlcd may not work correctly if you unplug/replug when it's in the middle of transferring data (i.e. printing or scanning), because it may have trouble re-synchronizing with the peripheral. > (but there were 4 ptal-printd's, also started by the hotplug script). That's to be expected, but it's probably not a good idea for this to happen. One of these days I'll add a proper init script to make it easy to invoke this at startup. I've had an idea brewing in the back of my mind for a while now that might make it easier to deal with the variable device address due to USB hotplug. Specifically, I would change ptal-mlcd to accept wildcards for the device node (-device "/dev/usb/lp*") and strings to search for in the device ID string, such as the model and possibly serial number. At activation time, it would expand the wildcard string (using glob(3)) and open each one and query the device ID string until it found one that matched. I could probably use a SysV-IPC named semaphore to prevent race conditions where multiple instances of ptal-mlcd are simultaneously looping through trying to find their respective devices. This way, I think you could start ptal-mlcd at startup (along with ptal-printd) and not even worry about hacking hotplug scripts. Kludgey but workable, I think. :-) It's not as elegant as the ioctls you added to usbdevfs, but I don't know if that got incorporated into the kernel code. What do you think about this scheme? David |