Bugzilla – Attachment 113138 Details for
Bug 235059
/dev/parport only accessible by superuser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
hal patch to make parport devices knwon.
hal-add_all_subsystems.diff (text/plain), 4.85 KB, created by
Juergen Weigert
on 2007-01-16 15:10:42 UTC
(
hide
)
Description:
hal patch to make parport devices knwon.
Filename:
MIME Type:
Creator:
Juergen Weigert
Created:
2007-01-16 15:10:42 UTC
Size:
4.85 KB
patch
obsolete
>Index: hal-0.5.8_git20061106/hald/linux/device.c >=================================================================== >--- hal-0.5.8_git20061106.orig/hald/linux/device.c >+++ hal-0.5.8_git20061106/hald/linux/device.c >@@ -2385,6 +2385,35 @@ pseudo_compute_udi (HalDevice *d) > > /*--------------------------------------------------------------------------------------------------------------*/ > >+static HalDevice * >+generic_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path) >+{ >+ HalDevice *d; >+ >+ d = hal_device_new (); >+ >+ hal_util_set_driver (d, "info.linux.driver", sysfs_path); >+ >+ return d; >+} >+ >+static gboolean >+generic_compute_udi (HalDevice *d) >+{ >+ gchar udi[256]; >+ >+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi), "%s_%s", >+ hal_device_property_get_string (d, "info.parent"), >+ hal_device_property_get_string (d, "linux.subsystem")); >+ hal_device_set_udi (d, udi); >+ hal_device_property_set_string (d, "info.udi", udi); >+ >+ return TRUE; >+} >+ >+ >+/*--------------------------------------------------------------------------------------------------------------*/ >+ > static gboolean > dev_remove (HalDevice *d) > { >@@ -2656,6 +2685,14 @@ static DevHandler dev_handler_pseudo = { > .remove = dev_remove > }; > >+static DevHandler dev_handler_generic = >+{ >+ .subsystem = "generic", >+ .add = generic_add, >+ .compute_udi = generic_compute_udi, >+ .remove = dev_remove >+}; >+ > /*--------------------------------------------------------------------------------------------------------------*/ > > static DevHandler *dev_handlers[] = { >@@ -2829,6 +2866,55 @@ out: > ; > } > >+static void >+dev_add(DevHandler *handler, >+ const gchar *subsystem, const gchar *sysfs_path, const gchar *device_file, >+ HalDevice *parent_dev, const gchar *parent_path, void *end_token) >+{ >+ HalDevice *d; >+ >+ /* attempt to add the device */ >+ d = handler->add (sysfs_path, device_file, parent_dev, parent_path); >+ if (d == NULL) { >+ /* didn't find anything - thus, ignore this hotplug event */ >+ hotplug_event_end (end_token); >+ return; >+ } >+ >+ if(!hal_device_has_property(d, "linux.sysfs_path")) { >+ hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path); >+ } >+ >+ if(!hal_device_has_property(d, "info.parent")) { >+ if (parent_dev != NULL) { >+ hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev)); >+ } else { >+ hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer"); >+ } >+ } >+ >+ if(!hal_device_has_property(d, "info.product")) { >+ gchar buf[256]; >+ g_snprintf(buf, sizeof(buf), "%s device %s", subsystem, device_file); >+ hal_device_property_set_string (d, "info.product", buf); >+ } >+ >+ hal_device_property_set_int (d, "linux.hotplug_type", HOTPLUG_EVENT_SYSFS_DEVICE); >+ hal_device_property_set_string (d, "linux.subsystem", subsystem); >+ >+ if (device_file != NULL && strlen (device_file) > 0) >+ hal_device_property_set_string (d, "linux.device_file", device_file); >+ >+ /* Add to temporary device store */ >+ hal_device_store_add (hald_get_tdl (), d); >+ >+ /* Process preprobe fdi files */ >+ di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE); >+ >+ /* Run preprobe callouts */ >+ hal_util_callout_device_preprobe (d, dev_callouts_preprobing_done, end_token, handler); >+} >+ > void > hotplug_event_begin_add_dev (const gchar *subsystem, const gchar *sysfs_path, const gchar *device_file, > HalDevice *parent_dev, const gchar *parent_path, >@@ -2855,33 +2941,20 @@ hotplug_event_begin_add_dev (const gchar > > handler = dev_handlers[i]; > if (strcmp (handler->subsystem, subsystem) == 0) { >- HalDevice *d; >- >- /* attempt to add the device */ >- d = handler->add (sysfs_path, device_file, parent_dev, parent_path); >- if (d == NULL) { >- /* didn't find anything - thus, ignore this hotplug event */ >- hotplug_event_end (end_token); >- goto out; >- } >- >- hal_device_property_set_int (d, "linux.hotplug_type", HOTPLUG_EVENT_SYSFS_DEVICE); >- hal_device_property_set_string (d, "linux.subsystem", subsystem); > >- if (device_file != NULL && strlen (device_file) > 0) >- hal_device_property_set_string (d, "linux.device_file", device_file); >+ dev_add(handler, subsystem, sysfs_path, >+ device_file, parent_dev, parent_path, end_token); > >- /* Add to temporary device store */ >- hal_device_store_add (hald_get_tdl (), d); >- >- /* Process preprobe fdi files */ >- di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE); >- >- /* Run preprobe callouts */ >- hal_util_callout_device_preprobe (d, dev_callouts_preprobing_done, end_token, handler); > goto out; > } > } >+ >+ if(dev_handlers[i] == NULL && device_file && strlen(device_file) > 0) { >+ dev_add(&dev_handler_generic, subsystem, sysfs_path, >+ device_file, parent_dev, parent_path, end_token); >+ >+ goto out; >+ } > > /* didn't find anything - thus, ignore this hotplug event */ > hotplug_event_end (end_token);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 235059
:
113138
|
185738