Enhancement: udev system script to get uart for serial port

Bug #44190 reported by Ilkka Tuohela
6
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Invalid
Medium
Scott James Remnant (Canonical)

Bug Description

Binary package hint: udev

Sysfs or udev don't export UART of a serial port, which means you really can't use it to detect weird cards by it.

For example, I have a option globetrotter gprs card, which has 2 serial ports, one for proprietary control connection and one for normal serial connection. These ports can be really detected only by UART, thus I need a way to tell which one is which from udev rules.

Revision history for this message
Ilkka Tuohela (hile) wrote : Udev script to do this

Attached is my script to detect UART from userland using /proc. The script should be in /lib/udev/serial_uart

Eventually, UART should be shown in sysfs tree, usable from udev. Meanwhile this script does what is needed (except when /proc is not mounted at all).

Example udev rules for my GPRS card:

SYSFS{prod_id1}=="Option International", SYSFS{prod_id2}=="GSM/GPRS GlobeTrotter", IMPORT{program}="serial_uart %p"

### Control channel device, not really used in linux
SYSFS{prod_id1}=="Option International", SYSFS{prod_id2}=="GSM/GPRS GlobeTrotter", ENV{SERIAL_UART}=="16450", SYMLINK+="globetrotter/control"

### Normal serial device
SYSFS{prod_id1}=="Option International", SYSFS{prod_id2}=="GSM/GPRS GlobeTrotter", ENV{SERIAL_UART}=="16550A", SYMLINK+="globetrotter/serial"

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I'm sorry but I don't see a bug here

You've just proved that udev _can_ do everything you need, you add a little helper to grab the information you want and put it into the environment, and then base rules off it?

Or am I massively missing something?

Changed in udev:
assignee: nobody → keybuk
status: Unconfirmed → Rejected
Revision history for this message
Ilkka Tuohela (hile) wrote :

Yes, this is not a bug, but enhancement - /lib/udev contains multiple scripts to call for importing or resolving stuff which is not itself available from udev or sysfs directly.

My wish is to include this to default ubuntu udev package so that anyone needing the uart from rules can use it directly.

As I said, this really should be exported to sysfs by kernel itself: meanwhile, this script makes it possible to detect UART cleanly from udev rules.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The scripts that udev ships are used by the default rules, we don't ship anything "just in case" because it's impossible to determine the exact needs of anybody. It's fully permitted to add your own scripts on your own system.

I agree that anything exposed in /proc should be instead exposed in /sys, we have similar issues with the IDE devices. This is best taken upstream though.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.