summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2009-09-17 15:50:28 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2009-09-17 15:50:28 +0200
commit2e5eed0af0761ab6f7a15659ec1efa1f66ef1ea8 (patch)
tree1d6dffb9392b192fa178dd3a1ab80051c1440a42
parent026998cd83428776f833d251365dd6c247715894 (diff)
downloadhal-2e5eed0af0761ab6f7a15659ec1efa1f66ef1ea8.tar.gz
generalize keyboard detection code for FreeBSD
This is needed to get Xorg working nicely with hal. - Only set "input" for the info.category field - Set input.keys on devices which have keys.
-rw-r--r--hald/freebsd/hf-devtree.c6
-rw-r--r--hald/freebsd/hf-usb.c4
-rw-r--r--hald/freebsd/hf-util.c25
-rw-r--r--hald/freebsd/hf-util.h3
-rw-r--r--hald/freebsd/probing/probe-hiddev.c12
5 files changed, 25 insertions, 25 deletions
diff --git a/hald/freebsd/hf-devtree.c b/hald/freebsd/hf-devtree.c
index 410f3c68..7a54feb5 100644
--- a/hald/freebsd/hf-devtree.c
+++ b/hald/freebsd/hf-devtree.c
@@ -194,7 +194,7 @@ hf_devtree_fd_set_properties (HalDevice *device)
static void
hf_devtree_atkbd_set_properties (HalDevice *device)
{
- hf_device_set_input(device, "keyboard", NULL);
+ hf_device_set_input(device, "keyboard", "keys", NULL);
}
static void
@@ -203,7 +203,7 @@ hf_devtree_psm_set_properties (HalDevice *device)
char *devname;
devname = hf_devtree_device_get_name(device);
- hf_device_set_input(device, "mouse", devname);
+ hf_device_set_input(device, "mouse", NULL, devname);
g_free(devname);
}
@@ -213,7 +213,7 @@ hf_devtree_joy_set_properties (HalDevice *device)
char *devname;
devname = hf_devtree_device_get_name(device);
- hf_device_set_input(device, "joystick", devname);
+ hf_device_set_input(device, "joystick", NULL, devname);
g_free(devname);
if (! hal_device_has_property(device, "info.product"))
diff --git a/hald/freebsd/hf-usb.c b/hald/freebsd/hf-usb.c
index 9bb6f3c3..280e0dbd 100644
--- a/hald/freebsd/hf-usb.c
+++ b/hald/freebsd/hf-usb.c
@@ -392,9 +392,9 @@ hf_usb_device_new (HalDevice *parent,
hf_devtree_device_set_name(device, di->udi_devnames[0]);
if ((devname = hf_usb_get_devname(di, "ukbd"))) /* USB keyboard */
- hf_device_set_input(device, "keyboard", NULL);
+ hf_device_set_input(device, "keyboard", "keys", devname);
else if ((devname = hf_usb_get_devname(di, "ums"))) /* USB mouse */
- hf_device_set_input(device, "mouse", devname);
+ hf_device_set_input(device, "mouse", NULL, devname);
else if ((devname = hf_usb_get_devname(di, "uhid"))) /* UHID device */
{
hal_device_property_set_string(device, "info.category", "hiddev");
diff --git a/hald/freebsd/hf-util.c b/hald/freebsd/hf-util.c
index 96063601..aa54f578 100644
--- a/hald/freebsd/hf-util.c
+++ b/hald/freebsd/hf-util.c
@@ -326,24 +326,31 @@ hf_device_property_set_string_printf (HalDevice *device,
void
hf_device_set_input (HalDevice *device,
- const char *class,
+ const char *capability1,
+ const char *capability2,
const char *devname)
{
g_return_if_fail(HAL_IS_DEVICE(device));
hal_device_add_capability(device, "input");
+ if (capability1)
+ {
+ char *capability;
- if (class)
+ capability = g_strdup_printf("input.%s", capability1);
+ hal_device_add_capability(device, capability);
+ g_free(capability);
+ }
+ if (capability2)
{
- char *category;
+ char *capability;
- category = g_strdup_printf("input.%s", class);
- hal_device_property_set_string(device, "info.category", category);
- hal_device_add_capability(device, category);
- g_free(category);
+ capability = g_strdup_printf("input.%s", capability2);
+ hal_device_add_capability(device, capability);
+ g_free(capability);
}
- else
- hal_device_property_set_string(device, "info.category", "input");
+
+ hal_device_property_set_string(device, "info.category", "input");
if (devname)
hf_device_property_set_string_printf(device, "input.device", "/dev/%s", devname);
diff --git a/hald/freebsd/hf-util.h b/hald/freebsd/hf-util.h
index d4590ce6..3ac34b11 100644
--- a/hald/freebsd/hf-util.h
+++ b/hald/freebsd/hf-util.h
@@ -87,7 +87,8 @@ void hf_device_property_set_string_printf (HalDevice *device,
...) G_GNUC_PRINTF(3, 4);
void hf_device_set_input (HalDevice *device,
- const char *class,
+ const char *capability1,
+ const char *capability2,
const char *devname);
HalDevice *hf_device_store_get_parent (HalDeviceStore *store,
diff --git a/hald/freebsd/probing/probe-hiddev.c b/hald/freebsd/probing/probe-hiddev.c
index 916ae09c..f0c598b3 100644
--- a/hald/freebsd/probing/probe-hiddev.c
+++ b/hald/freebsd/probing/probe-hiddev.c
@@ -132,30 +132,22 @@ main (int argc, char **argv)
hid_dispose_report_desc(report_desc);
- if (is_keyboard || is_mouse || is_joystick)
+ if (is_keyboard || is_mouse || is_joystick || is_keypad)
{
libhal_device_add_capability(hfp_ctx, hfp_udi, "input", &hfp_error);
+ libhal_device_set_property_string(hfp_ctx, hfp_udi, "info.category", "input", &hfp_error);
libhal_device_set_property_string(hfp_ctx, hfp_udi, "input.device", device_file, &hfp_error);
}
if (is_keyboard)
- {
libhal_device_add_capability(hfp_ctx, hfp_udi, "input.keyboard", &hfp_error);
- libhal_device_set_property_string(hfp_ctx, hfp_udi, "info.category", "input.keyboard", &hfp_error);
- }
if (is_keypad)
libhal_device_add_capability(hfp_ctx, hfp_udi, "input.keypad", &hfp_error);
if (is_keyboard || is_keypad)
libhal_device_add_capability(hfp_ctx, hfp_udi, "input.keys", &hfp_error);
if (is_mouse)
- {
libhal_device_add_capability(hfp_ctx, hfp_udi, "input.mouse", &hfp_error);
- libhal_device_set_property_string(hfp_ctx, hfp_udi, "info.category", "input.mouse", &hfp_error);
- }
if (is_joystick)
- {
libhal_device_add_capability(hfp_ctx, hfp_udi, "input.joystick", &hfp_error);
- libhal_device_set_property_string(hfp_ctx, hfp_udi, "info.category", "input.joystick", &hfp_error);
- }
end:
return 0;