Hi,
Zhang, Zhenhua wrote:
Sometimes, Udev device 'remove' event could not report
correct
parent node of current udev_device. Current code replies on
the devpath attached on the parent node to find modem and then
remove it.
This fix is to change the way to store the devpath info into a
hashtable. So that we search hashtable to get devpath and
remove the modem.
---
It's a proposed patch to fix Meego bug #395 [1].
oFono relies on udev to report device remove event. The devpath info of the modem is
stored in the parent node of tty port. In below case, we try to find this parent node of
/dev/ttyACM0. The expected path of node is ".../usb1/1-4", which is modem device
itself. On Netbook, however, it returns ".../usb1" sometimes. In such case, we
could not find the correct devpath and modem so that modem was never removed.
My idea is to use a hashtable to store the mapping between tty path and modem path. So
that we could find the modem path without depending on udev_device_get_parent() in
remove_modem.
Wrong log is listed below. The expected path is
'/devices/pci0000:00/0000:00:1d.7/usb1/1-4/', but it returns
'.../0000:00:1d.7/usb1', which is Linux USB host controller.
Wrong log 1:
remove_modem() device 0x9223820
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.1/tty/ttyACM0
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
remove_modem() device 0x9222628
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.3/tty/ttyACM1
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
remove_modem() device 0x92233a8
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.7/net/wwan0
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
remove_modem() device 0x9224520
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.9/tty/ttyACM2
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
Wrong log 2:
remove_modem() device 0x9226398
path #0 /1-4:1.1/tty/ttyACM0
remove_modem() device 0x9226398
path #0 /1-4:1.3/tty/ttyACM1
remove_modem() device 0x9226398
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.9/tty/ttyACM2
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
remove_modem() device 0x9224880
path #0 /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.7/net/wwan0
path #1 /devices/pci0000:00/0000:00:1d.7/usb1
path #2 /devices/pci0000:00/0000:00:1d.7/usb1
path #3 /devices/pci0000:00/0000:00:1d.7
path #4 /devices/pci0000:00
[1]
http://bugs.meego.com/show_bug.cgi?id=395
Regards,
Zhenhua