Skip to contentSkip to conversation

Bug#294123: udev: Bad parsing of regular expressions in *.rules

DISCUSSION Marco d'Itri 3 participants 9 messages Feb 8, 2005 – Feb 14, 2005

lore
Share & tools
lore
#0 lore raw

----- Forwarded message from Ricardo Galli <[email protected]> -----

Subject: Bug#294123: udev: Bad parsing of regular expressions in *.rules
Reply-To: Ricardo Galli <[email protected]>, [email protected]
X-Debian-PR-Message: report 294123
X-Debian-PR-Package: udev
X-Debian-PR-Keywords:
From: Ricardo Galli <[email protected]>
To: Debian Bug Tracking System <[email protected]>

Package: udev
Version: 0.051-1
Severity: important

I have the following rule in /etc/udev/rules.d/palm.rules:

BUS="usb", SYSFS{manufacturer}="Palm. Inc.", KERNEL="ttyUSB[024]", NAME="%k", SYMLINK="pilot"

This rule created a symlink /dev/pilot to the first device created when the Palm is connected to USB.

Up to version 0.50 it worked fine, but in last version udevs creates the symlink to /dev/ttyUSB1 instead of /dev/ttyUSB0

By changing to KERNEL="ttyUSB[135]" it creates the right links.

-- Package-specific info:
-- /etc/udev/rules.d/:
/etc/udev/rules.d/:
total 16

lrwxrwxrwx  1 root root    19 2004-12-05 09:30 cd-aliases.rules -> ../cd-aliases.rules
-rw-r--r--  1 root root   588 2004-11-14 13:09 palm.rules
-rw-r--r--  1 root root 12288 2005-02-08 01:13 .palm.rules.swp
lrwxrwxrwx  1 root root    13 2004-11-13 02:21 udev.rules -> ../udev.rules

-- /sys/:
/sys/block/fd0/dev
/sys/block/hda/dev
/sys/block/hda/hda1/dev
/sys/block/hda/hda2/dev
/sys/block/hdc/dev
/sys/block/sda/dev
/sys/block/sda/sda1/dev
/sys/block/sda/sda2/dev
/sys/block/sda/sda3/dev
/sys/class/input/event0/dev
/sys/class/input/event1/dev
/sys/class/input/mice/dev
/sys/class/input/mouse0/dev
/sys/class/misc/hpet/dev
/sys/class/misc/hw_random/dev
/sys/class/misc/pktcdvd/dev
/sys/class/misc/psaux/dev
/sys/class/misc/rtc/dev
/sys/class/nvidia/nvidia0/dev
/sys/class/nvidia/nvidiactl/dev
/sys/class/sound/adsp/dev
/sys/class/sound/audio/dev
/sys/class/sound/controlC0/dev
/sys/class/sound/controlC1/dev
/sys/class/sound/controlC2/dev
/sys/class/sound/controlC3/dev
/sys/class/sound/dsp/dev
/sys/class/sound/mixer/dev
/sys/class/sound/pcmC0D0c/dev
/sys/class/sound/pcmC0D0p/dev
/sys/class/sound/pcmC0D1c/dev
/sys/class/sound/pcmC0D2c/dev
/sys/class/sound/pcmC0D3c/dev
/sys/class/sound/pcmC0D4p/dev
/sys/class/sound/timer/dev

-- Kernel configuration:
isapnp_init not present.

-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: LANG=es_ES@euro, LC_CTYPE=es_ES@euro (charmap=ISO-8859-15)

Versions of packages udev depends on:

ii  hotplug                  0.0.20040329-16 Linux Hotplug Scripts
ii  initscripts              2.86.ds1-1      Standard scripts needed for bootin
ii  libc6                    2.3.2.ds1-20    GNU C Library: Shared libraries an
ii  makedev                  2.3.1-75        Creates device files in /dev
ii  sed                      4.1.4-1         The GNU sed stream editor

-- debconf information:
udev/devfs-warning:
* udev/reboot-warning:

----- End forwarded message -----

Signature · 13 lines
ciao,
Marco


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw

----- Forwarded message from Ricardo Galli <[email protected]> -----

Subject: Bug#294123: udev: Bad parsing of regular expressions in *.rules
Reply-To: Ricardo Galli <[email protected]>, [email protected]
X-Debian-PR-Message: report 294123
X-Debian-PR-Package: udev
X-Debian-PR-Keywords: help upstream
From: Ricardo Galli <[email protected]>
Organization: UIB
To: [email protected]

Quoted 9 lines

Package: udev
Version: 0.051-1
Severity: important

I have the following rule in /etc/udev/rules.d/palm.rules:

BUS="usb", SYSFS{manufacturer}="Palm. Inc.", KERNEL="ttyUSB[024]", NAME="%k", SYMLINK="pilot"

Quoted 7 lines

This rule created a symlink /dev/pilot to the first device created when the Palm is connected to USB.

Up to version 0.50 it worked fine, but in last version udevs creates the symlink to /dev/ttyUSB1 instead of /dev/ttyUSB0

By changing to KERNEL="ttyUSB[135]" it creates the right links.

After further testing I realised is not always true, i.e. is not always repeatable.

[...]

Signature · 9 lines
  ricardo galli       GPG id C8114D34
  http://mnm.uib.es/gallir/
  We all live in a #FFFF00 submarine

----- End forwarded message -----

-- 
ciao,
Marco
#2 lore raw
In reply to Marco d'Itri
Quoted 10 lines · Marco d'Itri

----- Forwarded message from Ricardo Galli <[email protected]> -----

Subject: Bug#294123: udev: Bad parsing of regular expressions in *.rules
Reply-To: Ricardo Galli <[email protected]>, [email protected]
X-Debian-PR-Message: report 294123
X-Debian-PR-Package: udev
X-Debian-PR-Keywords:
From: Ricardo Galli <[email protected]>
To: Debian Bug Tracking System <[email protected]>

Quoted 8 lines

Package: udev
Version: 0.051-1
Severity: important

I have the following rule in /etc/udev/rules.d/palm.rules:

BUS="usb", SYSFS{manufacturer}="Palm. Inc.", KERNEL="ttyUSB[024]", NAME="%k", SYMLINK="pilot"

What is that supposed to do? One symlink name for multiple devices? Every second Palm interface should overwrite this symlink?

Quoted 5 lines

This rule created a symlink /dev/pilot to the first device created when the Palm is connected to USB.

Up to version 0.50 it worked fine, but in last version udevs creates the symlink to /dev/ttyUSB1 instead of /dev/ttyUSB0

What does:
udevinfo -q all -p /class/tty/ttyUSB0

print in the failure case?

Quoted 1 line

By changing to KERNEL="ttyUSB[135]" it creates the right links.

Hmm, we didn't change anything in the matching logic and it worked for a long time without any known problems. I expect something different as the problem.

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Marco d'Itri
Quoted 9 lines · Kay Sievers

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

This is a real tough one to try to match on, as these both point to the same exact physical device. Same USB interface even. It's a pain, stupid palm devices...

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Marco d'Itri

----- Forwarded message from Ricardo Galli <[email protected]> -----

Subject: Bug#294123: Info received (was Bug#294123: udev: Bad parsing of regular expressions in *.rules)
Reply-To: Ricardo Galli <[email protected]>, [email protected]

Sorry, I didn't see your post, so I'm asnwering a little late. Hope still helps.

Quoted 7 lines
Quoted 4 lines

I have the following rule in /etc/udev/rules.d/palm.rules:

BUS="usb", SYSFS{manufacturer}="Palm. Inc.", KERNEL="ttyUSB[024]", NAME="%k", SYMLINK="pilot"

What is that supposed to do? One symlink name for multiple devices? Every second Palm interface should overwrite this symlink?

Palm creates two devices, but only the first one is usable (at least by Kpilot). The only one just blocks the sync software.

Another contsraint is that the devices may change over time (depending on other devices). Sometimes may bye ttyUSB0 and 1, but next time ttyUSB2 and ttyUSB3. So only 0 and even numbers are useful, that was solved with the rule, it created a symlink to the even numbered ttyUSB.

Quoted 6 lines
Quoted 1 line

symlink to /dev/ttyUSB1 instead of /dev/ttyUSB0

What does:
udevinfo -q all -p /class/tty/ttyUSB0

print in the failure case?

udevinfo -q all -p /class/tty/ttyUSB0
P: /class/tty/ttyUSB0
N: ttyUSB0
S: pilot

udevinfo -q all -p /class/tty/ttyUSB1
P: /class/tty/ttyUSB1
N: ttyUSB1
S: pilot

Quoted 9 lines
Quoted 1 line

By changing to KERNEL="ttyUSB[135]" it creates the right links.

Hmm, we didn't change anything in the matching logic and it worked for a long time without any known problems. I expect something different as the problem.

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

Quoted 6 lines

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

I did it but found only the device numbers/Ids:

diff usb0 usb1
1,3c1,3
< device '/sys/class/tty/ttyUSB0' has major:minor 188:0
< looking at class device '/sys/class/tty/ttyUSB0':
< SYSFS{dev}="188:0"
---

Quoted 3 lines

device '/sys/class/tty/ttyUSB1' has major:minor 188:1
looking at class device '/sys/class/tty/ttyUSB1':

    SYSFS{dev}="188:1"

6c6
< looking at the device chain at
'/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/ttyUSB0':
---

Quoted 1 line

looking at the device chain at

'/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/ttyUSB1':
8c8
< ID="ttyUSB0"
---

Quoted 1 line
    ID="ttyUSB1"
Signature · 21 lines
  ricardo galli       GPG id C8114D34
  http://mnm.uib.es/gallir/
  Existen 10 tipos de personas, las que saben binario y
  otras nueve que no recuerdo

----- End forwarded message -----

-- 
ciao,
Marco


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#5 lore raw
In reply to Marco d'Itri
Quoted 8 lines · Greg KH
Quoted 7 lines · Kay Sievers

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

Quoted 6 lines
Quoted 2 lines

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

This is a real tough one to try to match on, as these both point to the same exact physical device. Same USB interface even. It's a pain, stupid palm devices...

Ahh, I see. So we may follow the link to the physical device and look for the name of the _first_ serial interface of this device? Would this solve the problem?

Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Marco d'Itri
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Greg KH
Quoted 9 lines · Kay Sievers

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

Quoted 7 lines
Quoted 3 lines

This is a real tough one to try to match on, as these both point to the same exact physical device. Same USB interface even. It's a pain, stupid palm devices...

Ahh, I see. So we may follow the link to the physical device and look for the name of the _first_ serial interface of this device? Would this solve the problem?

Heh, not quite, as you usually want the _second_ serial interface to sync off of, the first one is not useful at all (well, some tools use it, but 99% of the users never will care about it.)

And then there's the fun problem of some Sony devices creating two serial "devices" where the second one is just a "fake" one, and you really need to connect to the first.

Bah, sometimes I really hate Palm...

thanks,

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to Marco d'Itri
Quoted 25 lines · Greg KH
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Greg KH
Quoted 9 lines · Kay Sievers

Can't you match against some interface attributes in sysfs, which are telling you which one is the first interface of this device?

You may compare:
udevinfo -a -p /class/tty/ttyUSB0
udevinfo -a -p /class/tty/ttyUSB1

if you find a difference between both interfaces to match against, that is not dependent on the kernel device name.

Quoted 7 lines
Quoted 3 lines

This is a real tough one to try to match on, as these both point to the same exact physical device. Same USB interface even. It's a pain, stupid palm devices...

Ahh, I see. So we may follow the link to the physical device and look for the name of the _first_ serial interface of this device? Would this solve the problem?

Heh, not quite, as you usually want the _second_ serial interface to sync off of, the first one is not useful at all (well, some tools use it, but 99% of the users never will care about it.)

Quoted 5 lines

And then there's the fun problem of some Sony devices creating two serial "devices" where the second one is just a "fake" one, and you really need to connect to the first.

Bah, sometimes I really hate Palm...

Yeah, I can imagine that. But would it be possible to get the right one with the information available in sysfs? Someone could write a small script which matches the vendor and return a symlink for the _right_ interface. Would that work?

Btw: The "Bad parsing ..." wasn't a udev issue. It's solved.

Thanks,
Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to Marco d'Itri
Quoted 14 lines · Kay Sievers
Quoted 13 lines · Greg KH
Quoted 4 lines

Ahh, I see. So we may follow the link to the physical device and look for the name of the _first_ serial interface of this device? Would this solve the problem?

Heh, not quite, as you usually want the _second_ serial interface to sync off of, the first one is not useful at all (well, some tools use it, but 99% of the users never will care about it.)

And then there's the fun problem of some Sony devices creating two serial "devices" where the second one is just a "fake" one, and you really need to connect to the first.

Quoted 6 lines
Quoted 1 line

Bah, sometimes I really hate Palm...

Yeah, I can imagine that. But would it be possible to get the right one with the information available in sysfs? Someone could write a small script which matches the vendor and return a symlink for the _right_ interface. Would that work?

Yes, if the visor driver exported the type of the port that it was in sysfs (which it does not do right now, never got around to it as my visor is broken...) If anyone wants to take a look into doing this, look at the logic in the drivers/usb/serial/visor.c::palm_os_3_probe() function where it determines the port_function_id type. We should export that info to sysfs, for the os versions that support it. For palm os 4 and greater, I don't know how to get that information, sorry.

Quoted 1 line

Btw: The "Bad parsing ..." wasn't a udev issue. It's solved.

Yeah, I think I saw that go by in a bug report. Huge backlog of email today, that's what I get for being sick for 3 days...

thanks,

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel