After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 383865 - support for hotplugging keyboards
support for hotplugging keyboards
Status: RESOLVED INCOMPLETE
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-manager
SVN TRUNK
Other All
: Normal enhancement
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-12-08 21:35 UTC by Colin Watson
Modified: 2009-01-19 19:15 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
partial button hotplug support (5.30 KB, patch)
2006-12-08 21:36 UTC, Colin Watson
none Details | Review

Description Colin Watson 2006-12-08 21:35:45 UTC
gnome-power-manager only fetches HAL's list of devices with buttons when it starts up. If a keyboard device appears while gnome-power-manager is running, then it won't notice the power button being pressed on that keyboard.

I actually have a use for this. :-) The "mouseemu" program can be used on Macs to emulate the middle and right mouse buttons in a configurable way (e.g. F11 and F12, or Ctrl-click, or whatever); it replaces the sysctl hack we used to use for this by using the uinput facility in Linux 2.6 to create virtual keyboard and mouse devices. When using this, all keyboard and mouse events are captured and either swallowed or replayed over the virtual devices, possibly in a modified form. However, the virtual devices only appear once mouseemu starts, and if this happens after gnome-power-manager starts then gnome-power-manager won't know about the new keyboard device, but no events are going to show up on the old keyboard device any more so it won't be able to handle the power button.

This was originally https://launchpad.net/distros/ubuntu/+source/mouseemu/+bug/67954; you need to be apply mouseemu and hal patches in order for hal to pick up the virtual input devices (just setting the uinput bus type to BUS_VIRTUAL (0x06) and making hal's probe-input component accept that), but all the necessary patches are in the Ubuntu Feisty development archive as of today if you want to try it out.

I've been trying to fix this problem for a few hours, and I nearly managed it. My work-in-progress patch will be attached in a moment, mostly cribbed from gpm-battery.c. Unfortunately, for some reason I can't determine, when hal_device_added_cb is called gpm_hal_device_has_capability claims that the new device doesn't have the "button" capability, even though running "hal-device" shortly afterwards lists it in info.capabilities. If you can figure this out or suggest a workaround, that would be great.
Comment 1 Colin Watson 2006-12-08 21:36:31 UTC
Created attachment 77988 [details] [review]
partial button hotplug support
Comment 2 Richard Hughes 2006-12-09 20:10:20 UTC
Sorry for the delay, busy week. Looks good on quick review.

Why do you suggest using g_idle_add ((GSourceFunc)start_idle, button);?

Thanks.
Comment 3 Colin Watson 2006-12-10 00:37:20 UTC
I was copying gpm-battery.c :-)

Any ideas about the broken capability bit?
Comment 4 Richard Hughes 2006-12-16 14:20:45 UTC
It's possible we are adding the device before the capability - hence we ignore the device. Does the patch still work for you if you remove the hal_device_added_cb function?
Comment 5 Christoph Wurm 2009-01-19 19:15:42 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for.
Thanks!