Re: Udev rule for HSDPA modem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 4, 2008 at 20:11, Greg KH <greg@xxxxxxxxx> wrote:
> On Thu, Dec 04, 2008 at 10:56:32AM -0800, Greg KH wrote:
>> On Thu, Dec 04, 2008 at 09:27:15AM -0600, Karl O. Pinc wrote:
>> >
>> > I think what the Digi Edgeport 4/16 needs is the same rule set, but
>> > with the serial number also included in the name.  This is because
>> > it has an internal hub with 8 endpoints, each endpoint driving 2
>> > serial ports (io_ti), and my understanding is that the ports on the
>> > internal hub may not be discovered in the same order every time.
>> > However, each internal endpoint does have it's own serial
>> > number.  If that showed in the name then there'd be no
>> > problem.
>> >
>> > Of course I could be completely misunderstanding.
>>
>> Hm, good point, I think the by_id stuff will start conflicting if 2 of
>> the same types of devices are plugged in at the same time.

Yeah, that's intentional for by-id/, it should be independent of the
order of plug-in and the physical location it is plugged in, so the
usual case where you have only one device, or devices with proper
serial numbers, you always find it with exactly the same link name.

If you have multiple completely indentical devices this can obviously
not work, just like multiple partitions with the same filesystem label
overwrite the disk/by-label/ links. The you need to use the slightly
less convenient by-path/ links, and can not move the devices to
different ports.

>> Let me go dig through my boxes of usb stuff to find some duplicate
>> devices, and one of the 4/16 edgeport devices as well...
>
> Not a problem, the serial number is added to the "by-id" tree if it is
> present:

Yeah, usb_id always appends the serial number if it finds one.

> $ tree /dev/serial/
> /dev/serial/
> |-- by-id
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port0 -> ../../ttyUSB8
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port1 -> ../../ttyUSB9
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port2 -> ../../ttyUSB10
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port3 -> ../../ttyUSB11
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port4 -> ../../ttyUSB12
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port5 -> ../../ttyUSB13
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port6 -> ../../ttyUSB14
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port7 -> ../../ttyUSB15
> |   |-- usb-Keyspan_Serial-if00-port0 -> ../../ttyUSB0
> |   |-- usb-Keyspan__a_division_of_InnoSys_Inc._Keyspan_USB_Serial_Adapter-if00-port0 -> ../../ttyUSB1
> |   |-- usb-Keyspan__a_division_of_InnoSys_Inc._Keyspan_USB_Serial_Adapter-if00-port1 -> ../../ttyUSB2
> |   `-- usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 -> ../../ttyUSB7
> `-- by-path
>    |-- pci-0000:00:1d.2-usb-0:1.3:1.0-port0 -> ../../ttyUSB7
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port0 -> ../../ttyUSB0
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port0 -> ../../ttyUSB1
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port1 -> ../../ttyUSB2
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port0 -> ../../ttyUSB8
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port1 -> ../../ttyUSB9
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port2 -> ../../ttyUSB10
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port3 -> ../../ttyUSB11
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port4 -> ../../ttyUSB12
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port5 -> ../../ttyUSB13
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port6 -> ../../ttyUSB14
>    `-- pci-0000:00:1d.7-usb-0:6.3:1.0-port7 -> ../../ttyUSB15
>
> The problem is when you have 2 devices with no serial numbers, the last
> one in wins the "by_id" classification:
>
> $ tree /dev/serial/
> /dev/serial/
> |-- by-id
> |   `-- usb-067b_2303-if00-port0 -> ../../ttyUSB3
> `-- by-path
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.1:1.0-port0 -> ../../ttyUSB0
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.2:1.0-port0 -> ../../ttyUSB1
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.3:1.0-port0 -> ../../ttyUSB2
>    `-- pci-0000:00:1d.7-usb-0:6.1.4.2.4:1.0-port0 -> ../../ttyUSB3

Yeah, only by-path/ will work here. There is nothing we could do, just
like with the filesystem labels.

The nice thing is, if you would remove the device the link currently
points to, udev would re-create the link for the next device in the
stack of links with the same name. :)

> This is a 4 port, pl2303 device that is really a hub with 4 devices
> behind it.  No serial number either, so the by-id path isn't the best
> choice, but the by-path one is.
>
> And, just for fun, here's a bunch of usb-serial devices all plugged in
> at the same time:
>
> /dev/serial
> |-- by-id
> |   |-- usb-067b_2303-if00-port0 -> ../../ttyUSB3
> |   |-- usb-ACME_usb_widgets_ACME_USB_serial_widget_47-if00-port0 -> ../../ttyUSB19
> |   |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port0 -> ../../ttyUSB20
> |   |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port1 -> ../../ttyUSB21
> |   |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port2 -> ../../ttyUSB22
> |   |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port3 -> ../../ttyUSB23
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port0 -> ../../ttyUSB4
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port1 -> ../../ttyUSB5
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port2 -> ../../ttyUSB6
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port3 -> ../../ttyUSB7
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port4 -> ../../ttyUSB8
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port5 -> ../../ttyUSB9
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port6 -> ../../ttyUSB10
> |   |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port7 -> ../../ttyUSB11
> |   |-- usb-Keyspan_Serial-if00-port0 -> ../../ttyUSB14
> |   |-- usb-Keyspan__a_division_of_InnoSys_Inc._Keyspan_USB_Serial_Adapter-if00-port0 -> ../../ttyUSB24
> |   |-- usb-Keyspan__a_division_of_InnoSys_Inc._Keyspan_USB_Serial_Adapter-if00-port1 -> ../../ttyUSB25
> |   |-- usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 -> ../../ttyUSB17
> |   `-- usb-USB-RS232_Interface_Converter_USB_Ver1.1_Device_679016-if00-port0 -> ../../ttyUSB18
> `-- by-path
>    |-- pci-0000:00:1d.2-usb-0:1.2:1.0-port0 -> ../../ttyUSB19
>    |-- pci-0000:00:1d.2-usb-0:1.3:1.0-port0 -> ../../ttyUSB17
>    |-- pci-0000:00:1d.7-usb-0:6.1.1:1.0-port0 -> ../../ttyUSB24
>    |-- pci-0000:00:1d.7-usb-0:6.1.1:1.0-port1 -> ../../ttyUSB25
>    |-- pci-0000:00:1d.7-usb-0:6.1.2:1.0-port0 -> ../../ttyUSB20
>    |-- pci-0000:00:1d.7-usb-0:6.1.2:1.0-port1 -> ../../ttyUSB21
>    |-- pci-0000:00:1d.7-usb-0:6.1.2:1.0-port2 -> ../../ttyUSB22
>    |-- pci-0000:00:1d.7-usb-0:6.1.2:1.0-port3 -> ../../ttyUSB23
>    |-- pci-0000:00:1d.7-usb-0:6.1.3:1.0-port0 -> ../../ttyUSB18
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port0 -> ../../ttyUSB15
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port1 -> ../../ttyUSB16
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.1:1.0-port0 -> ../../ttyUSB0
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.2:1.0-port0 -> ../../ttyUSB1
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.3:1.0-port0 -> ../../ttyUSB2
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.2.4:1.0-port0 -> ../../ttyUSB3
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.3:1.0-port0 -> ../../ttyUSB14
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port0 -> ../../ttyUSB12
>    |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port1 -> ../../ttyUSB13
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port0 -> ../../ttyUSB4
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port1 -> ../../ttyUSB5
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port2 -> ../../ttyUSB6
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port3 -> ../../ttyUSB7
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port4 -> ../../ttyUSB8
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port5 -> ../../ttyUSB9
>    |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port6 -> ../../ttyUSB10
>    `-- pci-0000:00:1d.7-usb-0:6.3:1.0-port7 -> ../../ttyUSB11

Looks good. It think it's useful for many setups with more than one
serial device. And I still like the fact, that we can do that with
just 15 simple lines of udev rules.

Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux