Am Friday 11 September 2009 12:30:01 schrieb Christian Gmeiner: > Hi Stefan, > > I like the idea of adding more registry keys for hardware components. > I want some registry keys for usb devices > so I had a look at your patch. I don't like the mess with the added > goto serial. If in future there will be support > for usb and the whole source will be quite hard to follow. The usb > registry keys are needed e.g. for this [1]. > So i like to propose my idea how it could look like. > > In function new_device( LibHalContext *ctx, const char *udi ) we could > readout the info.subsystem setting of the newly added device and add a > if for info.subsystem strings like > block - block devices > tty - serial > usb_devices/usb - usb > > could look like > > /* HAL callback for new device */ > static void new_device( LibHalContext *ctx, const char *udi ) > { > DBusError error; > char *subsystem = NULL; > > p_dbus_error_init( &error ); > > if (!(subsystem = p_libhal_device_get_property_string( ctx, udi, > "info.subsystem", &error ))) > goto done; > > if (strcmp(subsystem == "block") == 0) > block_device( ctx, udi, &error ); > else if (strcmp(subsystem == "usb_device") == 0) > usb_device( ctx, udi, &error ); > else if (strcmp(subsystem == "tty") == 0) > serial_device( ctx, udi, &error ); > > p_dbus_error_free( &error ); > } >
Hi Christian, i like your idea, but a short test shows that "info.subsystem" is not available for drives. But "info.category" can be used. -- Stefan