Hello community,

here is the log from the commit of package acpid for openSUSE:Factory checked 
in at 2012-01-25 15:00:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/acpid (Old)
 and      /work/SRC/openSUSE:Factory/.acpid.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "acpid", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/acpid/acpid.changes      2012-01-05 
13:47:33.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.acpid.new/acpid.changes 2012-01-25 
15:01:01.000000000 +0100
@@ -1,0 +2,14 @@
+Tue Jan 17 23:43:46 UTC 2012 - [email protected]
+
+- Update to acpid 2.0.14
+  + fixed brace style (Ted Felix)
+  + added support for a "K" suffix on event strings to indicate
+    that they may have originated from a keyboard input layer
+    device. This can be used to differentiate between a power
+    switch on the keyboard, and a power switch on the computer's
+    case. (Ted Felix)
+  + Added a pathname to connection along with a find_connection_name()
+    Modifications to process_inotify() to log IN_DELETE events.
+    Additional debugging output (Ted Felix)
+
+-------------------------------------------------------------------

Old:
----
  acpid-2.0.13.tar.gz

New:
----
  acpid-2.0.14.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ acpid.spec ++++++
--- /var/tmp/diff_new_pack.HOfdsT/_old  2012-01-25 15:01:02.000000000 +0100
+++ /var/tmp/diff_new_pack.HOfdsT/_new  2012-01-25 15:01:02.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package acpid
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,13 +18,13 @@
 
 
 Name:           acpid
-Version:        2.0.13
+Version:        2.0.14
 Release:        0
 License:        GPL-2.0+
 Summary:        Executes Actions at ACPI Events
 Url:            http://tedfelix.com/linux/acpid-netlink.html
 Group:          System/Daemons
-Source:         http://tedfelix.com//linux/%{name}-%{version}.tar.gz
+Source:         http://tedfelix.com/linux/%{name}-%{version}.tar.gz
 Source2:        rcacpid
 Source3:        README.SuSE
 Source4:        thinkpad_acpi.modprobe

++++++ acpid-2.0.13.tar.gz -> acpid-2.0.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/Changelog new/acpid-2.0.14/Changelog
--- old/acpid-2.0.13/Changelog  2011-10-18 01:19:35.000000000 +0200
+++ new/acpid-2.0.14/Changelog  2011-12-09 23:31:36.000000000 +0100
@@ -1,3 +1,34 @@
+* Thu Dec 15 2011  Ted Felix <http://www.tedfelix.com>
+  - 2.0.14 release
+  - Fixed brace style.  (inotify_handler.c acpid.c)  (Ted Felix)
+  - Added support for a "K" suffix on event strings to indicate that they
+    may have originated from a keyboard input layer device.  This can be
+    used to differentiate between a power switch on the keyboard, and a power
+    switch on the computer's case.
+    
+    (connection_list.h inotify_handler.c input_layer.c netlink.c proc.c
+    sock.c)  (Ted Felix)
+    
+  - Added a pathname to connection along with a find_connection_name().  
+    Modifications to process_inotify() to log IN_DELETE events.  Additional 
+    debugging output.
+      
+    These changes were experimentation related to dealing with a ThinkPad 
+    suspend problem.  They should have no effect on acpid's behavior.  They 
are 
+    mainly noticeable as a change in the logging.
+    
+    The Problem: When resuming from suspend, the lid switch and power button's 
+    /dev/input event files do not trigger an IN_CREATE, so acpid doesn't 
+    reconnect to them.  Restarting acpid fixes this.
+    
+    Tried using IN_DELETE instead of ENODEV to detect the drivers going away.
+    Worked fine for disconnecting/reconnecting a USB keyboard, but not for the
+    ThinkPad suspend problem.  I've given up on fixing this as it appears to be
+    a kernel or driver issue.
+    
+    (connection_list.c connection_list.h inotify_handler.c input_layer.c 
+    netlink.c proc.c sock.c)  (Ted Felix)
+      
 * Tue Nov 15 2011  Ted Felix <http://www.tedfelix.com>
   - 2.0.13 release
   - Fix for socket name buffer overflow.  (ud_socket.c)  (Ted Felix)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/Makefile new/acpid-2.0.14/Makefile
--- old/acpid-2.0.13/Makefile   2011-10-18 01:12:24.000000000 +0200
+++ new/acpid-2.0.14/Makefile   2011-11-15 22:34:09.000000000 +0100
@@ -1,7 +1,7 @@
 # Makefile for ACPI daemon
 
 # update these numbers for new releases
-VERSION = 2.0.13
+VERSION = 2.0.14
 
 OPT = -O2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/acpid.c new/acpid-2.0.14/acpid.c
--- old/acpid-2.0.13/acpid.c    2011-10-18 01:06:54.000000000 +0200
+++ new/acpid-2.0.14/acpid.c    2011-12-08 02:59:39.000000000 +0100
@@ -80,16 +80,14 @@
        /* open the log */
        open_log();
        
-       if (!netlink)
-       {
+       if (!netlink) {
                /* open the acpi event file in the proc fs */
                /* if the open fails, try netlink */
                if (open_proc())
                        netlink = 1;
        }
 
-       if (netlink)
-       {
+       if (netlink) {
                /* open the input layer */
                open_input();
 
@@ -141,8 +139,7 @@
            logevents ? "on" : "off");
 
        /* main loop */
-       while (1)
-       {
+       while (1) {
                fd_set readfds;
                int nready;
                int i;
@@ -165,8 +162,7 @@
                acpid_close_dead_clients();
 
                /* for each connection */
-               for (i = 0; i <= get_number_of_connections(); ++i)
-               {
+               for (i = 0; i <= get_number_of_connections(); ++i) {
                        int fd;
 
                        p = get_connection(i);
@@ -179,8 +175,7 @@
                        fd = p->fd;
 
                        /* if this file descriptor has data waiting */
-                       if (FD_ISSET(fd, &readfds))
-                       {
+                       if (FD_ISSET(fd, &readfds)) {
                                /* delegate to this connection's process 
function */
                                p->process(fd);
                        }
@@ -300,8 +295,7 @@
                        }
                        for (opt = opts, hlp = opts_help;
                             opt->name;
-                            opt++, hlp++)
-                       {
+                            opt++, hlp++) {
                                fprintf(stderr, "  -%c, --%s",
                                        opt->val, opt->name);
                                size = strlen(opt->name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/connection_list.c 
new/acpid-2.0.14/connection_list.c
--- old/acpid-2.0.13/connection_list.c  2011-10-18 00:26:23.000000000 +0200
+++ new/acpid-2.0.14/connection_list.c  2011-12-03 04:29:00.000000000 +0100
@@ -22,6 +22,8 @@
 
 #include <unistd.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "acpid.h"
 #include "log.h"
@@ -88,8 +90,11 @@
        for (i = 0; i < nconnections; ++i) {
                /* if the file descriptors match, delete the connection */
                if (connection_list[i].fd == fd) {
+                       free(connection_list[i].pathname);
+                       
                        --nconnections;
                        connection_list[i] = connection_list[nconnections];
+                       
                        break;
                }
        }
@@ -117,6 +122,27 @@
                        return &connection_list[i];
        }
 
+       return NULL;
+}
+
+/*---------------------------------------------------------------*/
+
+struct connection *
+find_connection_name(char *pathname)
+{
+       int i;
+
+       /* for each connection */
+       for (i = 0; i < nconnections; ++i) {
+               /* skip null pathnames */
+               if (connection_list[i].pathname == NULL)
+                       continue;
+
+               /* if the pathname matches, return the connection */
+               if (strcmp(connection_list[i].pathname, pathname) == 0)
+                       return &connection_list[i];
+       }
+
        return NULL;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/connection_list.h 
new/acpid-2.0.14/connection_list.h
--- old/acpid-2.0.13/connection_list.h  2009-11-06 21:42:40.000000000 +0100
+++ new/acpid-2.0.14/connection_list.h  2011-12-16 01:14:37.000000000 +0100
@@ -35,7 +35,16 @@
        int fd;
 
        /* process incoming data on the connection */
+       /* ??? suggest passing a pointer to this connection struct */
        void (* process)(int fd);
+
+       /* Optional.  Used by find_connection_name() to find the connection for 
a 
+          specific file.  Set to NULL if not specified.  Memory will be freed 
+          with free() when connection is deleted. */
+       char *pathname;
+
+       /* 0 indicates this is probably not a keyboard device */
+       int kybd;
 };
 
 /* add a connection to the list */
@@ -45,8 +54,15 @@
 extern void delete_connection(int fd);
 
 /* find a connection in the list by file descriptor */
+/* ??? This routine is unnecessary.  When we call the connection's process
+ *     routine, we should pass a pointer to the connection.  That will have
+ *     the usual fd along with everything else. */
 extern struct connection *find_connection(int fd);
 
+/* find a connection in the list by pathname */
+/* ??? unused last I checked */
+extern struct connection *find_connection_name(char *pathname);
+
 /* get the number of connections in the list */
 extern int get_number_of_connections();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/inotify_handler.c 
new/acpid-2.0.14/inotify_handler.c
--- old/acpid-2.0.13/inotify_handler.c  2011-10-18 00:26:51.000000000 +0200
+++ new/acpid-2.0.14/inotify_handler.c  2011-12-08 02:55:03.000000000 +0100
@@ -53,13 +53,11 @@
        acpid_log(LOG_DEBUG, "inotify read bytes: %d", bytes);
 
        /* eof is not expected */       
-       if (bytes == 0)
-       {
+       if (bytes == 0) {
                acpid_log(LOG_WARNING, "inotify fd eof encountered");
                return;
        }
-       else if (bytes < 0)
-       {
+       else if (bytes < 0) {
                /* EINVAL means buffer wasn't big enough.  See inotify(7). */
                acpid_log(LOG_ERR, "inotify read error: %s (%d)",
                        strerror(errno), errno);
@@ -70,21 +68,43 @@
 
        acpid_log(LOG_DEBUG, "inotify name len: %d", eventbuf.event.len);
 
-       /* if a name is included */
-       if (eventbuf.event.len > 0)
-       {
-               const int dnsize = 256;
-               char devname[dnsize];
+       const int dnsize = 256;
+       char devname[dnsize];
 
+       /* if a name is included */
+       if (eventbuf.event.len > 0) {
                /* devname = ACPID_INPUTLAYERDIR + "/" + pevent -> name */
                strcpy(devname, ACPID_INPUTLAYERDIR);
                strcat(devname, "/");
                strncat(devname, eventbuf.event.name, dnsize - strlen(devname) 
- 1);
+       }
                
+       /* if this is a create */
+       if (eventbuf.event.mask & IN_CREATE) {
                acpid_log(LOG_DEBUG, "inotify about to open: %s", devname);
 
                open_inputfile(devname);
        }
+
+       /* if this is a delete */
+       if (eventbuf.event.mask & IN_DELETE) {
+               /* struct connection *c; */
+               
+               acpid_log(LOG_DEBUG, "inotify received a delete for: %s", 
devname);
+
+#if 0
+/* Switching back to the original ENODEV detection scheme.  See 
+   process_input() in input_layer.c. */
+/* keeping this for future reference */
+               /* search for the event file in the connection list */
+               /* ??? Or should we just have a delete_connection_name()? */
+               c = find_connection_name(devname);
+               
+               /* close that connection if found */
+               if (c)
+                       delete_connection(c->fd);
+#endif
+       }
 }
 
 /*-----------------------------------------------------------------*/
@@ -106,8 +126,8 @@
        
        acpid_log(LOG_DEBUG, "inotify fd: %d", fd);
 
-       /* watch for new files being created in /dev/input */
-       wd = inotify_add_watch(fd, ACPID_INPUTLAYERDIR, IN_CREATE);
+       /* watch for files being created or deleted in /dev/input */
+       wd = inotify_add_watch(fd, ACPID_INPUTLAYERDIR, IN_CREATE | IN_DELETE);
 
        if (wd < 0) {
                acpid_log(LOG_ERR, "inotify_add_watch() failed: %s (%d)",
@@ -121,6 +141,8 @@
        /* add a connection to the list */
        c.fd = fd;
        c.process = process_inotify;
+       c.pathname = NULL;
+       c.kybd = 0;
        add_connection(&c);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/input_layer.c 
new/acpid-2.0.14/input_layer.c
--- old/acpid-2.0.13/input_layer.c      2011-10-18 00:28:19.000000000 +0200
+++ new/acpid-2.0.14/input_layer.c      2011-12-09 00:01:12.000000000 +0100
@@ -188,6 +188,8 @@
        ssize_t nbytes;
        const char *str;
        static int nerrs;
+       struct connection *c;
+       char str2[100];
 
        nbytes = read(fd, &event, sizeof(event));
 
@@ -201,7 +203,8 @@
                if (errno == EINTR)
                        return;
                if (errno == ENODEV) {
-                       acpid_log(LOG_WARNING, "input device has been 
disconnected");
+                       acpid_log(LOG_WARNING, "input device has been 
disconnected, fd %d",
+                                 fd);
                        delete_connection(fd);
                        return;
                }
@@ -225,11 +228,27 @@
                return;
        }
 
+       c = find_connection(fd);
+       
+       /* if we're getting scancodes, we probably have a keyboard */
+       if (event.type == EV_MSC  &&  event.code == MSC_SCAN) {
+               if (c)
+                       c->kybd = 1;  /* appears to be a keyboard device */
+       }
+       
        /* convert the event into a string */
        str = event_string(event);
        /* if this is not an event we care about, bail */
        if (str == NULL)
                return;
+
+       /* If we suspect this is a keyboard, and we have enough space, tack a 
+        * "K" on to the end of the event string. */
+       if (c  &&  c->kybd  &&  strnlen(str, sizeof(str2)) <= sizeof(str2) - 3) 
{
+               strcpy(str2, str);
+               strcat(str2, " K");
+               str = str2;
+       }
        
        /* if we're locked, don't process the event */
        if (locked()) {
@@ -308,18 +327,30 @@
     fcntl(fd, F_SETFD, FD_CLOEXEC);
 
        if (fd >= 0) {
+               char evname[256];
+               
                /* if this file doesn't have events we need, indicate failure */
                if (!has_event(fd)) {
                        close(fd);
                        return -1;
                }
 
-               acpid_log(LOG_DEBUG, "input layer %s "
-                       "opened successfully", filename);
+               /* get this event file's name for debugging */
+               strcpy(evname, "Unknown");
+               ioctl(fd, EVIOCGNAME(sizeof(evname)), evname);
+
+               acpid_log(LOG_DEBUG, "input layer %s (%s) "
+                       "opened successfully, fd %d", filename, evname, fd);
 
                /* add a connection to the list */
                c.fd = fd;
                c.process = process_input;
+               /* delete_connection() will free */
+               c.pathname = malloc(strlen(filename) + 1);
+               if (c.pathname)
+                       strcpy(c.pathname, filename);
+               /* assume not a keyboard until we see a scancode */
+               c.kybd = 0;
                add_connection(&c);
 
                return 0;  /* success */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/netlink.c new/acpid-2.0.14/netlink.c
--- old/acpid-2.0.13/netlink.c  2011-10-18 00:29:43.000000000 +0200
+++ new/acpid-2.0.14/netlink.c  2011-12-08 01:34:42.000000000 +0100
@@ -233,6 +233,8 @@
        /* add a connection to the list */
        c.fd = rth.fd;
        c.process = process_netlink;
+       c.pathname = NULL;
+       c.kybd = 0;
        add_connection(&c);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/proc.c new/acpid-2.0.14/proc.c
--- old/acpid-2.0.13/proc.c     2011-10-18 00:27:39.000000000 +0200
+++ new/acpid-2.0.14/proc.c     2011-12-08 01:35:09.000000000 +0100
@@ -108,6 +108,8 @@
        /* add a connection to the list */
        c.fd = fd;
        c.process = process_proc;
+       c.pathname = NULL;
+       c.kybd = 0;
        add_connection(&c);
 
        return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/acpid-2.0.13/sock.c new/acpid-2.0.14/sock.c
--- old/acpid-2.0.13/sock.c     2011-10-18 00:27:54.000000000 +0200
+++ new/acpid-2.0.14/sock.c     2011-12-08 01:35:28.000000000 +0100
@@ -175,5 +175,7 @@
        /* add a connection to the list */
        c.fd = fd;
        c.process = process_sock;
+       c.pathname = NULL;
+       c.kybd = 0;
        add_connection(&c);
 }

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to