hal/hald/linux2/probing probe-input.c,1.3,1.4
David Zeuthen
david at freedesktop.org
Wed Feb 2 13:14:20 PST 2005
- Previous message: hal ChangeLog,1.398,1.399
- Next message: hal/hald/linux2 Makefile.am, 1.3, 1.4 acpi.c, 1.2, 1.3 acpi.h, 1.2,
1.3 coldplug.c, 1.5, 1.6 hotplug.c, 1.5, 1.6 hotplug.h, 1.2,
1.3 osspec.c, 1.5, 1.6 util.c, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/hald/linux2/probing
In directory gabe:/tmp/cvs-serv31772/hald/linux2/probing
Modified Files:
probe-input.c
Log Message:
2005-02-02 David Zeuthen <davidz at redhat.com>
* hald/linux2/probing/probe-input.c (main): Fix up error handling
here so Reprobe() on the root, /org/freedesktop/Hal/devices/computer,
actually works; here's some python to do that
#!/usr/bin/python
import dbus
bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
hal_service = bus.get_service ('org.freedesktop.Hal')
d = hal_service.get_object ('/org/freedesktop/Hal/devices/computer',
'org.freedesktop.Hal.Device')
d.Reprobe()
Index: probe-input.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-input.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- probe-input.c 1 Feb 2005 15:36:27 -0000 1.3
+++ probe-input.c 2 Feb 2005 21:14:18 -0000 1.4
@@ -44,6 +44,7 @@
check_abs (int fd, LibHalContext *ctx, const char *udi)
{
char bitmask[(ABS_MAX + 7) / 8];
+ DBusError error;
if (ioctl (fd, EVIOCGBIT(EV_ABS, sizeof (bitmask)), bitmask) < 0) {
fprintf(stderr, "ioctl EVIOCGBIT failed\n");
@@ -55,7 +56,8 @@
goto out;
}
- libhal_device_add_capability (ctx, udi, "input.tablet", NULL);
+ dbus_error_init (&error);
+ libhal_device_add_capability (ctx, udi, "input.tablet", &error);
out:
;
@@ -67,6 +69,7 @@
unsigned int i;
char bitmask[(KEY_MAX + 7) / 8];
int is_keyboard;
+ DBusError error;
if (ioctl (fd, EVIOCGBIT(EV_KEY, sizeof (bitmask)), bitmask) < 0) {
fprintf(stderr, "ioctl EVIOCGBIT failed\n");
@@ -84,7 +87,8 @@
}
if (is_keyboard) {
- libhal_device_add_capability (ctx, udi, "input.keyboard", NULL);
+ dbus_error_init (&error);
+ libhal_device_add_capability (ctx, udi, "input.keyboard", &error);
}
out:
@@ -95,6 +99,7 @@
check_rel (int fd, LibHalContext *ctx, const char *udi)
{
char bitmask[(REL_MAX + 7) / 8];
+ DBusError error;
if (ioctl (fd, EVIOCGBIT(EV_REL, sizeof (bitmask)), bitmask) < 0) {
fprintf(stderr, "ioctl EVIOCGBIT failed: %m\n");
@@ -106,7 +111,8 @@
goto out;
}
- libhal_device_add_capability (ctx, udi, "input.mouse", NULL);
+ dbus_error_init (&error);
+ libhal_device_add_capability (ctx, udi, "input.mouse", &error);
out:
;
@@ -121,6 +127,8 @@
char *device_file;
char *physical_device;
LibHalContext *ctx = NULL;
+ DBusError error;
+ DBusConnection *conn;
char name[128];
struct input_id id;
@@ -133,11 +141,15 @@
if (udi == NULL)
goto out;
+ dbus_error_init (&error);
+ if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
+ goto out;
+
if ((ctx = libhal_ctx_new ()) == NULL)
goto out;
- if (!libhal_ctx_set_dbus_connection (ctx, dbus_bus_get (DBUS_BUS_SYSTEM, NULL)))
+ if (!libhal_ctx_set_dbus_connection (ctx, conn))
goto out;
- if (!libhal_ctx_init (ctx, NULL))
+ if (!libhal_ctx_init (ctx, &error))
goto out;
device_file = getenv ("HAL_PROP_INPUT_DEVICE");
@@ -175,8 +187,10 @@
fprintf(stderr, "ioctl EVIOCGNAME failed\n");
goto out;
}
- libhal_device_set_property_string (ctx, udi, "info.product", name, NULL);
- libhal_device_set_property_string (ctx, udi, "input.product", name, NULL);
+ if (!libhal_device_set_property_string (ctx, udi, "info.product", name, &error))
+ goto out;
+ if (!libhal_device_set_property_string (ctx, udi, "input.product", name, &error))
+ goto out;
check_abs (fd, ctx, udi);
check_rel (fd, ctx, udi);
@@ -190,7 +204,8 @@
close (fd);
if (ctx != NULL) {
- libhal_ctx_shutdown (ctx, NULL);
+ dbus_error_init (&error);
+ libhal_ctx_shutdown (ctx, &error);
libhal_ctx_free (ctx);
}
- Previous message: hal ChangeLog,1.398,1.399
- Next message: hal/hald/linux2 Makefile.am, 1.3, 1.4 acpi.c, 1.2, 1.3 acpi.h, 1.2,
1.3 coldplug.c, 1.5, 1.6 hotplug.c, 1.5, 1.6 hotplug.h, 1.2,
1.3 osspec.c, 1.5, 1.6 util.c, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list