Unable to start p910nd daemon properly in udev rules

Ask questions about Arch Linux ARM. Please search before making a new topic.

Unable to start p910nd daemon properly in udev rules

Postby ccy » Wed Sep 25, 2013 12:57 am

I have a dot matrix printer connected to Raspberry Pi using USB Parallel cable. When I plug in the usb cable to Raspberry Pi, udevadm info show these:

$this->bbcode_second_pass_code('', '# udevadm info -a /sys/class/usbmisc/lp0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/usbmisc/lp0':
KERNEL=="lp0"
SUBSYSTEM=="usbmisc"
DRIVER==""

looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0':
KERNELS=="1-1.2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usblp"
ATTRS{bInterfaceClass}=="07"
ATTRS{bInterfaceSubClass}=="01"
ATTRS{bInterfaceProtocol}=="02"
ATTRS{bNumEndpoints}=="02"
ATTRS{supports_autosuspend}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
ATTRS{ieee1284_id}==""

looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2':
KERNELS=="1-1.2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="1.2"
ATTRS{idVendor}=="0fe6"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{busnum}=="1"
ATTRS{devnum}=="4"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="120mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0101"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 1.10"
ATTRS{urbnum}=="20"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="removable"
ATTRS{idProduct}=="811e"
ATTRS{bDeviceClass}=="00"
ATTRS{product}=="IEEE-1284 Controller"

looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="02"
ATTRS{devpath}=="1"
ATTRS{idVendor}=="0424"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="2"
ATTRS{configuration}==""
ATTRS{bMaxPower}==" 2mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="3"
ATTRS{bcdDevice}=="0200"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="34"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="9512"
ATTRS{bDeviceClass}=="09"

looking at parent device '/devices/platform/bcm2708_usb/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}==" 0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="1"
ATTRS{bcdDevice}=="0306"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="bcm2708_usb"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="25"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 3.6.11-14-ARCH+ dwc_otg_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="DWC OTG Controller"

looking at parent device '/devices/platform/bcm2708_usb':
KERNELS=="bcm2708_usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{srp}=="SesReqScs = 0x1"
ATTRS{regvalue}=="invalid offset"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{mode}=="Mode = 0x1"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{regdump}=="Register Dump"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 400 msecs (40 jiffies)"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000306"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"
ATTRS{busconnected}=="Bus Connected = 0x1"
ATTRS{hcddump}=="HCD Dump"
ATTRS{gotgctl}=="GOTGCTL = 0x001c0001"
ATTRS{spramdump}=="SPRAM Dump"
ATTRS{grxfsiz}=="GRXFSIZ = 0x00000306"
ATTRS{gsnpsid}=="GSNPSID = 0x4f54280a"
ATTRS{gusbcfg}=="GUSBCFG = 0x00001700"
ATTRS{hptxfsiz}=="HPTXFSIZ = 0x02000406"
ATTRS{devspeed}=="Device Speed = 0x0"
ATTRS{fr_interval}=="Frame Interval = 0x1d4c"
ATTRS{rem_wakeup_pwrdn}==""
ATTRS{bussuspend}=="Bus Suspend = 0x0"
ATTRS{buspower}=="Bus Power = 0x1"
ATTRS{hnpcapable}=="HNPCapable = 0x1"
ATTRS{rd_reg_test}=="Time to read GNPTXFSIZ reg 10000000 times: 1180 msecs (118 jiffies)"
ATTRS{enumspeed}=="Device Enumeration Speed = 0x1"
ATTRS{inv_sel_hsic}=="Invert Select HSIC = 0x0"
ATTRS{regoffset}=="0xffffffff"

looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
')
I then create a udev rules to start p910nd daemon when the printer is plug in:
$this->bbcode_second_pass_code('', '
# cat /# vi 99-local.rules
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usbmisc", \
ATTRS{idVendor}=="0fe6", ATTRS{idProduct}=="811e", \
SYMLINK+="kx1121", RUN+="/usr/bin/p910nd -f /dev/usb/%k 0"
')
And I run
$this->bbcode_second_pass_code('', '
# rmmod usblp; modprobe usblp
')
to reload lp0 usb device.

I can see /dev/kx1121 symbolic link was created:
$this->bbcode_second_pass_code('', '
# ls -al /dev/kx1121
lrwxrwxrwx 1 root root 7 Sep 25 06:06 /dev/kx1121 -> usb/lp0
')
But the p910nd daemon doesn't trigger:
$this->bbcode_second_pass_code('', '
# ps -ax | grep -i p910 ; netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.4:22 192.168.0.10:37126 ESTABLISHED
')
I re-run the following to reload lp0 again:
$this->bbcode_second_pass_code('', '
# rmmod usblp; modprobe usblp
')
and if I am fast, I can see the p910nd daemon is triggered:
$this->bbcode_second_pass_code('', '
# ps -ax | grep -i p910 ; netstat -nat
261 ? Ss 0:00 /usr/bin/p9100d -f /dev/usb/lp0 0
268 pts/0 S+ 0:00 grep -i p910
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:9100 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.4:22 192.168.0.10:49056 ESTABLISHED
')
After few seconds, the p910nd deamon will terminate and it ends up the daemon is not functioning.

Any ideas why I can't trigger p910nd in udev rules?

If I run in bash shell manually:
$this->bbcode_second_pass_code('', '
# /usr/bin/p9100d -f /dev/usb/lp0 0"
')
The p910nd daemon will stay and won't terminate.
ccy
 
Posts: 3
Joined: Wed Sep 25, 2013 12:51 am

Return to User Questions

Who is online

Users browsing this forum: No registered users and 7 guests