]> git.webhop.me Git - lcd4linux.git/commitdiff
additional debug output
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 25 Sep 2009 12:57:51 +0000 (12:57 +0000)
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 25 Sep 2009 12:57:51 +0000 (12:57 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1045 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_G15.c
lcd4linux.c
svn_version.h

index eca3c31cd6e41abd83ce2b9170bbf5a023b01b7f..94380be076b02b26d7006e03919cd452f99ad25a 100644 (file)
--- a/drv_G15.c
+++ b/drv_G15.c
@@ -45,6 +45,9 @@
 #include <linux/input.h>
 #include <linux/uinput.h>
 
+#include <unistd.h>
+#include <sys/types.h>
+
 #include "debug.h"
 #include "cfg.h"
 #include "qprintf.h"
@@ -315,7 +318,7 @@ static int drv_G15_open()
 
     g15_lcd = NULL;
 
-    info("%s: Scanning USB for G-15 keyboard...", Name);
+    info("%s: Scanning USB for G-15 keyboard or Z-10 speaker ...", Name);
 
     usb_init();
     usb_set_debug(0);          // 0: no, 1 error, 2 warn, 3 info
@@ -332,7 +335,7 @@ static int drv_G15_open()
                    case G15_DEVICE2:
                    case M1730_DEVICE:
                        {
-                           info("%s: Found Logitech G-15 Keyboard", Name);
+                           info("%s: Found Logitech G-15 or Dell M1730 Keyboard", Name);
                            interf = 0;
                            config = 1;
                            usb_endpoint = 0x02;
@@ -352,22 +355,44 @@ static int drv_G15_open()
                    if (interf >= 0) {
                        debug("%s: Vendor 0x%x Product 0x%x found",
                              Name, dev->descriptor.idVendor, dev->descriptor.idProduct);
-                       //if (dev->descriptor.bNumConfigurations > 1) {
+
                        /* detach from the kernel if we need to */
                        retval = usb_get_driver_np(g15_lcd, interf, dname, 31);
                        debug("%s: Ret %i from usb_get_driver_np(interf.%d), Drivername %s",
                              Name, retval, interf, dname);
+                       switch (retval) {
+                       case -EPERM:
+                           error("%s: Permission denied! eUID of this process is %i %s",
+                                 Name, geteuid(), geteuid() != 0 ? "(not root)" : "");
+                           return -1;
+                           break;
+                       case -ENODATA:
+                           error("%s: No data available! Device switched off?", Name);
+                           return -1;
+                           break;
+                       }
                        if (retval == 0 && strcmp(dname, "usbhid") == 0) {
                            debug("%s: detaching...", Name);
                            usb_detach_kernel_driver_np(g15_lcd, interf);
                        }
+
                        retval = usb_set_configuration(g15_lcd, config);
                        debug("%s: Ret %d from usb_set_configuration(%d)", Name, retval, config);
+                       switch (retval) {
+                       case -EPERM:
+                           error("%s: Permission denied! eUID of this process is %i %s",
+                                 Name, geteuid(), geteuid() != 0 ? "(not root)" : "");
+                           return -1;
+                           break;
+                       case -EBUSY:
+                           error("%s: Device or resource busy! Device switched off?", Name);
+                           return -1;
+                           break;
+                       }
                        usleep(100);
-                       //}
                        retval = usb_claim_interface(g15_lcd, interf);
                        debug("%s: Ret %i from usb_claim_interface(%d)", Name, retval, interf);
-                       return 0;
+                       return retval;
                    }
 
                }
@@ -548,7 +573,7 @@ static int drv_G15_start(const char *section)
 /* list models */
 int drv_G15_list(void)
 {
-    printf("Logitech G-15 / Dell M1730");
+    printf("Logitech G-15 or Z-10 / Dell M1730");
     return 0;
 }
 
index dda62cf2c419b0c29d37c91c6d45c976d35b58e4..79941ca15aea7e2d2ada8943b140e010229c7e70 100644 (file)
@@ -289,11 +289,15 @@ int main(int argc, char *argv[])
        info("invoked without full path; restart may not work!");
     }
 
-    if (cfg_init(cfg) == -1)
+    if (cfg_init(cfg) == -1) {
+       error("Error reading configuration. Exit!");
        exit(1);
+    }
 
-    if (plugin_init() == -1)
+    if (plugin_init() == -1) {
+       error("Error initializing plugins. Exit!");
        exit(1);
+    }
 
     display = cfg_get(NULL, "Display", NULL);
     if (display == NULL || *display == '\0') {
@@ -344,6 +348,7 @@ int main(int argc, char *argv[])
 
     debug("initializing driver %s", driver);
     if (drv_init(section, driver, quiet) == -1) {
+       error("Error initializing driver %s: Exit!", driver);
        pid_exit(pidfile);
        exit(1);
     }
index ece57713f59e87080bebbb76d3cf146f42a7941a..81947864fd45a0cd8a65f42d76db112a04849487 100644 (file)
@@ -1 +1 @@
-#define SVN_VERSION "965"
+#define SVN_VERSION "1044"