Hi, Andrew and Denis,
From: ofono-bounces(a)ofono.org [mailto:firstname.lastname@example.org] On Behalf Of
Sent: Thursday, February 11, 2010 6:38 AM
Subject: Re: [PATCH] Add support of Huawei EM770 modem
> There are two known parts of code that may have problem and need your
> comments. 1. Once connecting this modem to PC via USB, we can get 5 tty
> ports: ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3 and ttyUSB4. The correct way to
> talk to this modem is using ttyUSB2. I'm not sure if I handled this
> correctly in file udev.c. 2. When creating the modem, a global modem id
So Andrew had it exactly correct, you can't just use ttyUSB2 here. Most
devices have other udev attributes you can examine for what type of port it
is, to help you pick the right one. Perhaps examination of 'udevadm info --
attribute-walk --path=<device>' might be in order?
The check of "ttyUSB2" in my code is not the same as you see in /dev directory.
Below is the output of this modem along its path (not a full path and I removed some
unimportant attributes in each path):
looking at device
looking at parent device
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.2':
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-3':(device4)
In oFono code, "device4" represents the modem, while "device1" is the
udev_device when calling function add_huawei_em770(modem, udev_device). When I check if
it's ttyUSB2 or not in my code, I think I'm checking the device1 and its sysname
(Showed as KERNEL in device1, but not the one showed in /dev directory), and in the
context of this modem (device4). I do believe there may be some other ttyUSB2 in the
system, for example, we have another em770 modem pluged in. But these two ttyUSB2 are in
different context. I ever tried to change the name showed in /dev directory by writing
some udev rules, but this sysname (KERNEL) seems stable (It's still ttyUSB2). Is it
possible this sysname gets changed under some circumstance expect the kernel or driver
changes? If not, I still think it's safe and convenient to check this value here.
Maybe we can use another attribute "bInterfaceNumber". But this attribute is
udev_device's parent's parent (device3), so the code could become more
complicated. What's your opinion?
> will be appended to the name of it while constructing the path. This modem
> has name "huawei_em770", thus the path becomes things like
> "/huawei_em7700" or "/huawei_em7701". This looks strange. Need I
> the name of this modem, or can we use some smarter way to append the modem
We should be using the udev short serial from the device. For some reason
this seems to be failing on the EM770. Can you check whether get_serial
returns NULL for this device?
Yes. get_serial() will return NULL, and we just use its type as name.
ofono mailing list