Bugzilla – Attachment 185738 Details for
Bug 235059
/dev/parport only accessible by superuser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
updated patch
0001-add-all-devices.diff (text/plain), 5.65 KB, created by
Ludwig Nussel
on 2007-12-04 08:53:45 UTC
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Ludwig Nussel
Created:
2007-12-04 08:53:45 UTC
Size:
5.65 KB
patch
obsolete
>From c4b65bbef3fbef9851877871fa7acf3b920eebc6 Mon Sep 17 00:00:00 2001 >From: Ludwig Nussel <ludwig.nussel@suse.de> >Date: Tue, 4 Dec 2007 09:12:24 +0100 >Subject: [PATCH] add all devices > >except some excessive tty devices > >Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> >--- > hald/linux/device.c | 129 ++++++++++++++++++++++++++++++++++++++++----------- > 1 files changed, 101 insertions(+), 28 deletions(-) > >diff --git a/hald/linux/device.c b/hald/linux/device.c >index c346bd5..a803fc3 100644 >--- a/hald/linux/device.c >+++ b/hald/linux/device.c >@@ -3346,6 +3346,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) > { >@@ -3646,6 +3675,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[] = { >@@ -3824,6 +3861,60 @@ out: > ; > } > >+static gboolean >+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; >+ >+ if (strcmp (subsystem, "scsi") == 0) >+ if (missing_scsi_host (sysfs_path, (HotplugEvent *)end_token, HOTPLUG_ACTION_ADD)) >+ return TRUE; // XXX need hotplug_event_end() and FALSE here? >+ >+ /* attempt to add the device */ >+ d = handler->add (sysfs_path, device_file, parent_dev, parent_path); >+ if (d == NULL) { >+ /* didn't match - there may be a later handler for the device though */ >+ return FALSE; >+ } >+ >+ 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); >+ >+ return TRUE; >+} >+ > void > hotplug_event_begin_add_dev (const gchar *subsystem, const gchar *sysfs_path, const gchar *device_file, > HalDevice *parent_dev, const gchar *parent_path, >@@ -3850,38 +3941,20 @@ hotplug_event_begin_add_dev (const gchar *subsystem, const gchar *sysfs_path, co > > handler = dev_handlers[i]; > if (strcmp (handler->subsystem, subsystem) == 0) { >- HalDevice *d; >- >- if (strcmp (subsystem, "scsi") == 0) >- if (missing_scsi_host (sysfs_path, (HotplugEvent *)end_token, HOTPLUG_ACTION_ADD)) >- goto out; >- >- /* attempt to add the device */ >- d = handler->add (sysfs_path, device_file, parent_dev, parent_path); >- if (d == NULL) { >- /* didn't match - there may be a later handler for the device though */ >- continue; >- } >- >- 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); >- goto out; >+ if(dev_add(handler, subsystem, sysfs_path, >+ device_file, parent_dev, parent_path, end_token)) >+ goto out; > } > } > >- /* didn't find anything - thus, ignore this hotplug event */ >+ if(dev_handlers[i] == NULL && device_file && strlen(device_file) > 0) { >+ if(dev_add(&dev_handler_generic, subsystem, sysfs_path, >+ device_file, parent_dev, parent_path, end_token)) >+ goto out; >+ } >+ >+ /* if we come here noone wanted the event - thus, ignore this hotplug event */ > hotplug_event_end (end_token); > out: > ; >-- >1.5.3.4 >
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