pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/48402: sysutils/hal - cdrom ejection fixup



>Number:         48402
>Category:       pkg
>Synopsis:       sysutils/hal - cdrom ejection fixup
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 23 05:30:00 +0000 2013
>Originator:     Nat Sloss
>Release:        pkgsrc-2013Q2
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (PCIPAE) #22: Thu Nov 21 23:13:25 
EST 2013  build@microrusty:/usr/src/sys/arch/i386/compile/obj/PCIPAE i386
>Description:
I have found that with hal the volume cd0d does not inherit any methods from 
its storage device cd0 so eject does not work.

I have also found that the cd eject button on the cdrom does not work if a 
medium is inserted as hald-addon-storage keeps rcd0d open if a disc is inserted.


>How-To-Repeat:
with hald running insert an audio cd wail approx. 30 seconds start kscd from 
kde 4 or another program that uses hal to eject and press eject nothing 
happens.  Also with kscd open press the eject button and again nothing happens.
>Fix:
Apply these patches:

--- /dev/null   2013-11-23 15:34:43.000000000 +1100
+++ pkgsrc/sysutils/hal/patches/patch-hald_hald__dbus.c 2013-11-16 
15:12:06.000000000 +1100
@@ -0,0 +1,87 @@
+$NetBSD$
+
+--- hald/hald_dbus.c.orig      2009-08-24 12:42:30.000000000 +0000
++++ hald/hald_dbus.c
+@@ -5077,11 +5077,14 @@ hald_dbus_filter_handle_methods (DBusCon
+               return do_introspect (connection, message, local_interface);
+       } else {
+               const char *interface;
++              const char *storageinterface = 
"org.freedesktop.Hal.Device.Storage";
+               const char *udi;
++              const char *parentudi;
+               const char *method;
+               const char *signature;
+               const char *caller;
+               HalDevice *d;
++              HalDevice *parent;
+                 GSList *i;
+                 HalDeviceStrListIter if_iter;
+                 CICallerInfo *ci;
+@@ -5114,6 +5117,14 @@ hald_dbus_filter_handle_methods (DBusCon
+                 if (d == NULL)
+                         goto out;
+ 
++              parent = NULL;
++              parentudi = hal_device_property_get_string (d, 
"block.storage_device");
++              if (parentudi != NULL) {
++                      parent = hal_device_store_find (hald_get_gdl (), 
parentudi);
++                      if (parent == NULL)  
++                              parent = hal_device_store_find (hald_get_tdl 
(), parentudi);
++              }
++
+                 /* no security checks; each method implementation is supposed 
to 
+                  * check this (with e.g. PolicyKit) itself... 
+                  */
+@@ -5161,19 +5172,27 @@ hald_dbus_filter_handle_methods (DBusCon
+                                 return DBUS_HANDLER_RESULT_HANDLED;
+                         }
+                 }
++              hal_device_property_strlist_iter_init (d, "info.interfaces", 
&if_iter);
++              if (!hal_device_property_strlist_iter_is_valid (&if_iter)) {
++                      if (parent != NULL) {
++                              d = parent;
++                              hal_device_property_strlist_iter_init (parent, 
"info.interfaces",
++                                  &if_iter);
++                      }
++              }
+ 
+                 /* nope, see if we have a program to run.. */        
+-                for (hal_device_property_strlist_iter_init (d, 
"info.interfaces", &if_iter);
+-                     hal_device_property_strlist_iter_is_valid (&if_iter);
++                for (;hal_device_property_strlist_iter_is_valid (&if_iter);
+                      hal_device_property_strlist_iter_next (&if_iter)) {
+                         const char *ifname = 
hal_device_property_strlist_iter_get_value (&if_iter);
+                         
+-                        if (strcmp (ifname, interface) == 0) {
++                        if (strcmp (ifname, interface) == 0 || strcmp 
(ifname, storageinterface) == 0) {
+                                 guint num;
+                                 HalDeviceStrListIter name_iter;
+                                 char *s;
+                                 
+-                                s = g_strdup_printf ("%s.method_names", 
interface);
++                                      s = g_strdup_printf ("%s.method_names", 
ifname);
++
+                                 hal_device_property_strlist_iter_init (d, s, 
&name_iter);
+                                 g_free (s);
+                                 for (num = 0; 
+@@ -5185,17 +5204,17 @@ hald_dbus_filter_handle_methods (DBusCon
+                                                 const char *execpath;
+                                                 const char *sig;
+                                                 
+-                                                s = g_strdup_printf 
("%s.method_execpaths", interface);
++                                                s = g_strdup_printf 
("%s.method_execpaths", ifname);
+                                                 execpath = 
hal_device_property_get_strlist_elem (d, s, num);
+                                                 g_free (s);
+-                                                s = g_strdup_printf 
("%s.method_signatures", interface);
++                                                s = g_strdup_printf 
("%s.method_signatures", ifname);
+                                                 sig = 
hal_device_property_get_strlist_elem (d, s, num);
+                                                 g_free (s);
+                                                 
+                                                 if (execpath != NULL && sig 
!= NULL && 
+                                                     strcmp (sig, signature) 
== 0) {
+                                                         
+-                                                        HAL_INFO (("OK for 
method '%s' with signature '%s' on interface '%s' for UDI '%s' and execpath 
'%s'", method, signature, interface, udi, execpath));
++                                                        HAL_INFO (("OK for 
method '%s' with signature '%s' on interface '%s' for UDI '%s' and execpath 
'%s'", method, signature, ifname, udi, execpath));
+                                                         
+                                                         return 
hald_exec_method (d, ci, connection, 
+                                                                               
   local_interface,
--- /dev/null   2013-11-23 15:34:43.000000000 +1100
+++ pkgsrc/sysutils/hal/patches/patch-hald_netbsd_addons_addon-storage.c        
2013-11-16 15:12:06.000000000 +1100
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- hald/netbsd/addons/addon-storage.c.orig    2013-11-15 15:04:52.000000000 
+0000
++++ hald/netbsd/addons/addon-storage.c
+@@ -455,6 +455,8 @@ main (int argc, char *argv[])
+                               HAL_DEBUG (("state has not changed %d %s", 
state, device_file));
+                               /* TODO check if eject button was pressed */
+                               /* see linux addons/addon-storage.c */
++                              if (state == DISC_INSERTED)
++                                      close_device (&fd);
+                               continue;
+                       } else {
+                               HAL_DEBUG (("new state %d %s", state, 
device_file));



Home | Main Index | Thread Index | Old Index