Re: Udev rule for HSDPA modem

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

 



> On Wed, 2008-12-03 at 15:10 -0800, Greg KH wrote:
>> On Wed, Dec 03, 2008 at 04:11:29PM +0100, Kay Sievers wrote:
>> > On Wed, 2008-12-03 at 13:12 +0100, Kay Sievers wrote:
>> > > On Wed, Dec 3, 2008 at 10:27, Kay Sievers <kay.sievers@xxxxxxxx> wrote:
>> > > > On Wed, Dec 3, 2008 at 07:45, Greg KH <greg@xxxxxxxxx> wrote:
>> > > >> On Sun, Nov 30, 2008 at 06:21:11AM +0100, Kay Sievers wrote:
>> > > >>> On Sat, Nov 29, 2008 at 18:37, Greg KH <greg@xxxxxxxxx> wrote:
>> > > >>> > On Sat, Nov 29, 2008 at 10:00:59AM +0200, Jar wrote:
>> > > >>> >> Greg KH wrote:
>> > > >>> >>> HAL contains a list of these modems and a mapping of each port to what
>> > > >>> >>> it does based on the specific device.
>> > > >>> >>> Try using that instead of udev specific rules for your accessed to the
>> > > >>> >>> modem, it will work much better.
>> > > >>> >>
>> > > >>> >> Thanks for your reply! Does HAL require that I have desktop installed,
>> this
>> > > >>> >> is my home "server" machine without X? Do you have any starting point
>> or
>> > > >>> >> where to learn more how to do this with HAL.
>> > > >>> >
>> > > >>> > I do not think HAL requires X.  Try asking on your distro mailing list
>> > > >>> > for how they have incorporated HAL into the releases you are using.
>> > > >>>
>> > > >>> It might get pretty complicated to use D-Bus/HAL for simple setups,
>> > > >>> and rather static configurations like this. NetworkManager handles
>> > > >>> that, and we will even get modem-probing soon, but in cases like this
>> > > >>> it might be easier to have a simple - not very flexible - but working
>> > > >>> solution.
>> > > >>>
>> > > >>> Maybe we can have an "index" sysfs file at the serial device, which
>> > > >>> carries the instance number, per usb device? This would allow us to
>> > > >>> create persistent links which do not depend on the kernel device
>> > > >>> enumeration across multiple device.
>> > > >>>
>> > > >>> We did the same for v4l devices recently:
>> > > >>>   http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=539a7555b31e65e66fb84c881d07d2bf18c974d0
>> > > >>>
>> > > >>> Greg, what do you think?
>> > > >>
>> > > >> Don't we already have something like this today (the "ports" on an
>> > > >> individual usb-serial device)?  Or do we just need to export that a bit
>> > > >> better?
>> > > >
>> > > > Yeah, maybe that works already. I don't have such a device.
>> > >
>> > > Ok, I found one. You mean "port_number", right? But unfortunately it
>> > > looks pretty useless in this case. :)
>> > >
>> > >   $ grep . /sys/bus/usb-serial/devices/*/port_number
>> > >   /sys/bus/usb-serial/devices/ttyUSB1/port_number:0
>> > >   /sys/bus/usb-serial/devices/ttyUSB2/port_number:0
>> > >
>> > > They would only be not "0" if the serial lines would be on the same
>> > > usb interface?
>> > >
>> > > We would need a per-device enumeration, but that's nothing the
>> > > usb-serial stuff knows/cares about if we have different usb
>> > > interfaces, right?
>> >
>> > Greg, do you have a usb multi-port serial card? Can you possibly give
>> > this a try, and show us "tree /dev/serial"?
>> >
>> > I have this here now for my "simple" devices:
>> >   /dev/serial
>> >   `-- by-id
>> >       |-- usb-067b_2303-serial-if00-port0 -> ../../ttyUSB0
>> >       |-- usb-HUAWEI_Technology_HUAWEI_Mobile-serial-if00-port0 -> ../../ttyUSB1
>> >       `-- usb-HUAWEI_Technology_HUAWEI_Mobile-serial-if01-port0 -> ../../ttyUSB2
>> >
>> > If we can make that work as expected, I'll look into by-path/, so we can
>> > have identical devices properly identified, if needed. Then we can check
>> > how we should finally name all that, and possibly add that stuff to the
>> > default rule set.
>>
>>
>> This looks good, here's the output using udev 133 and the rules and a
>> few usb-serial devices plugged into the system at the same time:
>>
>> $ tree /dev/serial/
>> /dev/serial/
>> `-- by-id
>>     |-- usb-Inside_Out_Networks_Edgeport
>>     |   |-- 4_04-01-006467-serial-if00-port0 -> ../../../ttyUSB0
>>     |   |-- 4_04-01-006467-serial-if00-port1 -> ../../../ttyUSB1
>>     |   |-- 4_04-01-006467-serial-if00-port2 -> ../../../ttyUSB2
>>     |   `-- 4_04-01-006467-serial-if00-port3 -> ../../../ttyUSB3
>>     |--
>> usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-serial-if00-port0
>> -> ../../ttyUSB8
>>     |--
>> usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-serial-if00-port1
>> -> ../../ttyUSB9
>>     |--
>> usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-serial-if00-port2
>> -> ../../ttyUSB10
>>     |--
>> usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-serial-if00-port3
>> -> ../../ttyUSB11
>>     |-- usb-Prolific_Technology_Inc._USB-Serial_Controller-serial-if00-port0 ->
>> ../../ttyUSB7
>>     |-- usb-Sierra_Wireless__Incorporated_AirCard-serial-if00-port0 ->
>> ../../ttyUSB4
>>     |-- usb-Sierra_Wireless__Incorporated_AirCard-serial-if00-port1 ->
>> ../../ttyUSB5
>>     `-- usb-Sierra_Wireless__Incorporated_AirCard-serial-if00-port2 ->
>> ../../ttyUSB6
>>
>> I'm not so sure about the long names, but it is unique :)
>
> Yeah, it looks really strange with your devices. Why put people poetry
> in the device strings? :)
>
> But it seems to work, which is great. Here is a new version of the
> serial.rules and a /lib/udev/path_id which needs to be replaced.
>
> Can you try that again on your "collection"? :)
>
> Thanks,
> Kay
> # do not edit this file, it will be overwritten on update
>
> ACTION!="add|change", GOTO="persistent_serial_end"
> SUBSYSTEM!="tty", GOTO="persistent_serial_end"
> KERNEL!="ttyUSB[0-9]*", GOTO="persistent_serial_end"
>
> SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}"
> ENV{ID_PORT}=="", GOTO="persistent_serial_end"
>
> IMPORT="path_id"
> ENV{ID_PATH}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}"
>
> IMPORT="usb_id --export"
> ENV{ID_SERIAL}=="", GOTO="persistent_serial_end"
> SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}"
> ENV{ID_IFACE}=="", GOTO="persistent_serial_end"
> SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}"
>
> LABEL="persistent_serial_end"
>

I can't test this right now, but doesn't quite understand what this will do. Does
this solve the problem where the ttyUSBx interface changes and make it always be the
same?

If I have e.g. ttyUSB1,ttyUSB2 and ttyUSB3 devices, what will be the symlink to
ttyUSB1 (used for pppd), which only interests? And how about the other thing, how to
trigger some wvdial connect script via udev at the same time the ttyUSB1 thing comes
up?


-- 
Best Regards, Jar
--
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