libusb and hal



Hi,

After doing some hacking in pilot-link for the z22 to get to work with libusb (and to work at all, because visor is also no more working), I've already made a (dirty) patch for pilot-link (see the "z22 F7 problem" thread for more details) to get pilot-xfer to work. Now the next problem is gnome-pilot.

It came to my attention that it worked every time the first time the z22 was connected to the computer after a reboot, and it would not work anymore the next times. So I did some investigation and figured the root of the problem.
When the z22 is connected, the hal_device_added function in gpilotd.c is called a few times, each time with different hal information. only one time this part of code will succeed:
if (!(bus = libhal_device_get_property_string (hal_ctx, udi, "info.bus", NULL))) {
        return;
    }
    if (strcmp (bus, "usb_device") != 0 ) {
        libhal_free_string (bus);
        return;
    }
So this means gpilotd is waiting for a "usb_device" to be added by hal, which works the first time.  But the next times the "usb_device" is not added anymore, as this device stays available in hal. Here is a part of the output of hal-device:
0: udi = '/org/freedesktop/Hal/devices/usb_device_830_61_noserial'
  linux.subsystem = 'usb'  (string)
  info.product = 'Palm Handheld'  (string)
  usb_device.device_revision_bcd = 256  (0x100)  (int)
  usb_device.product = 'Palm Handheld'  (string)
  usb_device.product_id = 97  (0x61)  (int)
  usb_device.speed = 12  (double)
  usb_device.vendor = 'Palm, Inc.'  (string)
  usb_device.can_wake_up = false  (bool)
  usb_device.configuration_value = 1  (0x1)  (int)
  usb_device.linux.device_number = 16  (0x10)  (int)
  info.linux.driver = 'usb'  (string)
  usb_device.device_class = 255  (0xff)  (int)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_02_0'  (string)
  usb_device.bus_number = 2  (0x2)  (int)
  usb_device.device_protocol = 0  (0x0)  (int)
  usb_device.is_self_powered = true  (bool)
  info.subsystem = 'usb_device'  (string)
  info.vendor = 'Palm, Inc.'  (string)
  usb_device.version = 1.1  (double)
  usb_device.num_interfaces = 1  (0x1)  (int)
  usb_device.vendor_id = 2096  (0x830)  (int)
  usb_device.speed_bcd = 4608  (0x1200)  (int)
  usb_device.version_bcd = 272  (0x110)  (int)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_830_61_noserial'  (string)
  usb_device.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:02.0/usb2/2-3'  (string)
  usb_device.num_configurations = 1  (0x1)  (int)
  info.bus = 'usb_device'  (string)
  linux.device_file = '/dev/bus/usb/002/016'  (string)
  usb_device.num_ports = 0  (0x0)  (int)
  usb_device.max_power = 500  (0x1f4)  (int)
  linux.hotplug_type = 2  (0x2)  (int)
  usb_device.device_subclass = 0  (0x0)  (int)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:02.0/usb2/2-3'  (string)

so if I do "hal-device -r /org/freedesktop/Hal/devices/usb_device_830_61_noserial" this item will be removed from the hal list, and the next time I connect my z22 gnome-pilot will work!

So now I know the cause of the problem, but I don't know how to fix this. Should hal normally remove this device? Should gnome-pilot not wait for an "usb_device" but for something else? ... ?

Can somebody help me on this?

Kind regards,
Tom Billiet


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