RFC: Addon singleton support

David Zeuthen david at fubar.dk
Mon Jun 11 12:28:42 PDT 2007


On Thu, 2007-06-07 at 12:12 +0100, Rob Taylor wrote:
> Set of updated patches attached. I haven't got a USB keyboard to hand to
>  test last-item removal, but it should be fixed now.
> 
> Also attached is a patch to make LibHalPropertySet a hashtable. I used
> uthash.h [1], it's not exactly the tidiest hashtable implementation, but
> it was the most capable well-licensed implementation I could find.

Ok, so I looked a bit more at this; I think everything but the
addon-input.c looks fine - except that some patch against the spec is
still needed detailing how this actually is supposed to work. Also,
without a working application (addon-input.c) it's pretty hard to verify
that it actually works in practice. 

(I wish we had some test case for these things, but now I digress.)

I guess the bugs in addon-input.c stem from the fact that you didn't
test with a USB keyboard. In [1] is the debug output that I get; for
your convenience I've manually indented output from addon-input.c. The
proc title doesn't get updated either. I guess the initial debug
messages stem from getting G_IO_HUP or G_IO_ERR, and then returning
FALSE in event_io(). This leads to the removal of the event source and
destroy_data() getting triggered. And destroy_data() removes the device
from the hash table making the later call (via IPC) to remove_device()
fail.

So I think we're almost there, to sum up

 - I think you need to test all the code paths; e.g. get a USB keyboard
   or find a way to simulate it

 - Need a patch for the spec; for instance the detail that a singleton-
   addon *should* exit when the last device is detached should be
   spelled out loud and clear.

Thanks,
David


  15:20:10.944 [D] addon-input.c:328: Removing '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_logicaldev_input'
  15:20:10.944 [D] addon-input.c:328: Removing '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1_logicaldev_input'
15:20:10.944 [I] osspec.c:233: SEQNUM=1445, ACTION=remove, SUBSYSTEM=usb_endpoint, DEVPATH=/sys/class/usb_endpoint/usbdev2.16_ep81, DEVNAME=/dev/usbdev2.16_ep81, IFINDEX=0
15:20:10.944 [I] device.c:3492: remove_dev: subsys=usb_endpoint sysfs_path=/sys/class/usb_endpoint/usbdev2.16_ep81
15:20:10.944 [W] device.c:3496: Error removing device
15:20:10.945 [I] osspec.c:233: SEQNUM=1448, ACTION=remove, SUBSYSTEM=usb, DEVPATH=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0, DEVNAME=, IFINDEX=0
15:20:10.945 [I] hotplug.c:110: /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0 is a device (store)
15:20:10.945 [I] device.c:3492: remove_dev: subsys=usb sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0
15:20:10.945 [I] device.c:3305: Remove callouts completed udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if0
15:20:10.945 [I] hald.c:143: Removed device from GDL; udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if0
15:20:10.948 [I] osspec.c:233: SEQNUM=1446, ACTION=remove, SUBSYSTEM=input, DEVPATH=/sys/class/input/input41/event15, DEVNAME=/dev/input/event15, IFINDEX=0
15:20:10.948 [I] hotplug.c:110: /sys/class/input/input41/event15 is a device (store)
15:20:10.948 [I] device.c:3492: remove_dev: subsys=input sysfs_path=/sys/class/input/input41/event15
15:20:10.948 [I] device.c:3305: Remove callouts completed udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_logicaldev_input
15:20:10.948 [I] hald.c:143: Removed device from GDL; udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_logicaldev_input
15:20:10.948 [D] hald_dbus.c:3329: singleton_signal_device_changed about to send message to connection 0x9f349a0
  15:20:10.949 [D] addon-input.c:401: Removing channel for '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_logicaldev_input'
  15:20:10.949 [E] addon-input.c:404: DeviceRemove called for unknown device: '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_logicaldev_input'
15:20:10.951 [I] osspec.c:233: SEQNUM=1449, ACTION=remove, SUBSYSTEM=usb_endpoint, DEVPATH=/sys/class/usb_endpoint/usbdev2.16_ep82, DEVNAME=/dev/usbdev2.16_ep82, IFINDEX=0
15:20:10.951 [I] device.c:3492: remove_dev: subsys=usb_endpoint sysfs_path=/sys/class/usb_endpoint/usbdev2.16_ep82
15:20:10.951 [W] device.c:3496: Error removing device
15:20:10.951 [I] osspec.c:233: SEQNUM=1450, ACTION=remove, SUBSYSTEM=input, DEVPATH=/sys/class/input/input42/mouse4, DEVNAME=/dev/input/mouse4, IFINDEX=0
15:20:10.951 [I] device.c:3492: remove_dev: subsys=input sysfs_path=/sys/class/input/input42/mouse4
15:20:10.951 [W] device.c:3496: Error removing device
15:20:10.952 [I] osspec.c:233: SEQNUM=1451, ACTION=remove, SUBSYSTEM=input, DEVPATH=/sys/class/input/input42/event16, DEVNAME=/dev/input/event16, IFINDEX=0
15:20:10.952 [I] hotplug.c:110: /sys/class/input/input42/event16 is a device (store)
15:20:10.952 [I] device.c:3492: remove_dev: subsys=input sysfs_path=/sys/class/input/input42/event16
15:20:10.952 [I] device.c:3305: Remove callouts completed udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1_logicaldev_input
15:20:10.952 [I] hald.c:143: Removed device from GDL; udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1_logicaldev_input
15:20:10.952 [D] hald_dbus.c:3329: singleton_signal_device_changed about to send message to connection 0x9f349a0
  15:20:10.952 [D] addon-input.c:401: Removing channel for '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1_logicaldev_input'
  15:20:10.953 [E] addon-input.c:404: DeviceRemove called for unknown device: '/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1_logicaldev_input'
15:20:10.953 [I] osspec.c:233: SEQNUM=1453, ACTION=remove, SUBSYSTEM=usb, DEVPATH=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.1, DEVNAME=, IFINDEX=0
15:20:10.953 [I] hotplug.c:110: /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.1 is a device (store)
15:20:10.953 [I] device.c:3492: remove_dev: subsys=usb sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.1
15:20:10.953 [I] device.c:3305: Remove callouts completed udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1
15:20:10.953 [I] hald.c:143: Removed device from GDL; udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial_if1
15:20:10.954 [I] osspec.c:233: SEQNUM=1454, ACTION=remove, SUBSYSTEM=usb_endpoint, DEVPATH=/sys/class/usb_endpoint/usbdev2.16_ep00, DEVNAME=/dev/usbdev2.16_ep00, IFINDEX=0
15:20:10.954 [I] device.c:3492: remove_dev: subsys=usb_endpoint sysfs_path=/sys/class/usb_endpoint/usbdev2.16_ep00
15:20:10.954 [W] device.c:3496: Error removing device
15:20:10.954 [I] osspec.c:233: SEQNUM=1447, ACTION=remove, SUBSYSTEM=input, DEVPATH=/sys/class/input/input41, DEVNAME=, IFINDEX=0
15:20:10.954 [I] device.c:3492: remove_dev: subsys=input sysfs_path=/sys/class/input/input41
15:20:10.954 [W] device.c:3496: Error removing device
15:20:10.954 [I] osspec.c:233: SEQNUM=1455, ACTION=remove, SUBSYSTEM=usb, DEVPATH=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1, DEVNAME=/dev/2-1, IFINDEX=0
15:20:10.954 [I] hotplug.c:110: /sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1 is a device (store)
15:20:10.954 [I] device.c:3492: remove_dev: subsys=usb sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1
15:20:10.954 [I] device.c:3305: Remove callouts completed udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial
15:20:10.955 [I] hald.c:143: Removed device from GDL; udi=/org/freedesktop/Hal/devices/usb_device_46d_c512_noserial
15:20:10.960 [I] osspec.c:233: SEQNUM=1452, ACTION=remove, SUBSYSTEM=input, DEVPATH=/sys/class/input/input42, DEVNAME=, IFINDEX=0
15:20:10.960 [I] device.c:3492: remove_dev: subsys=input sysfs_path=/sys/class/input/input42
15:20:10.960 [W] device.c:3496: Error removing device

     David



More information about the hal mailing list