Fix sensor hotplugging
Hotplugged sensors were not working because of the missing DEVICE_FOR_TYPE entry. Logged error message: driver_set_polling: assertion 'sensor_device' failed Fixes: 4baa1f ("main: Make it possible to instantiate multiple drivers")
This commit is contained in:
@@ -950,16 +950,21 @@ sensor_changes (GUdevClient *client,
|
|||||||
SensorDriver *driver = (SensorDriver *) drivers[i];
|
SensorDriver *driver = (SensorDriver *) drivers[i];
|
||||||
if (!driver_type_exists (data, driver->type) &&
|
if (!driver_type_exists (data, driver->type) &&
|
||||||
driver_discover (driver, device)) {
|
driver_discover (driver, device)) {
|
||||||
|
SensorDevice *sensor_device = NULL;
|
||||||
|
|
||||||
g_debug ("Found hotplugged device %s of type %s at %s",
|
g_debug ("Found hotplugged device %s of type %s at %s",
|
||||||
g_udev_device_get_sysfs_path (device),
|
g_udev_device_get_sysfs_path (device),
|
||||||
driver_type_to_str (driver->type),
|
driver_type_to_str (driver->type),
|
||||||
driver->driver_name);
|
driver->driver_name);
|
||||||
|
|
||||||
if (driver_open (driver, device,
|
sensor_device = driver_open (driver, device,
|
||||||
driver_type_to_callback_func (driver->type), data)) {
|
driver_type_to_callback_func (driver->type), data);
|
||||||
|
|
||||||
|
if (sensor_device) {
|
||||||
GHashTable *ht;
|
GHashTable *ht;
|
||||||
|
|
||||||
UDEV_DEVICE_FOR_TYPE(driver->type) = g_object_ref (device);
|
UDEV_DEVICE_FOR_TYPE(driver->type) = g_object_ref (device);
|
||||||
|
DEVICE_FOR_TYPE(driver->type) = sensor_device;
|
||||||
DRIVER_FOR_TYPE(driver->type) = (SensorDriver *) driver;
|
DRIVER_FOR_TYPE(driver->type) = (SensorDriver *) driver;
|
||||||
send_driver_changed_dbus_event (data, driver->type);
|
send_driver_changed_dbus_event (data, driver->type);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user