Author: pebender
Date: Wed Jun  3 20:45:04 2009
New Revision: 4887

Modified:
    trunk/gar-minimyth/script/system/lirc/checksums
     
trunk/gar-minimyth/script/system/lirc/files/lirc-0.8.5-lircmd_uinput.patch

Log:
- Fixed lircmd uinput patch so that the uinput device obeys accelerator  
settings.
- Changed lircmd so that it uses either /dev/lircm or uinput, but never  
both.



Modified: trunk/gar-minimyth/script/system/lirc/checksums
==============================================================================
--- trunk/gar-minimyth/script/system/lirc/checksums     (original)
+++ trunk/gar-minimyth/script/system/lirc/checksums     Wed Jun  3 20:45:04 2009
@@ -8,7 +8,7 @@
  7fef9c434332248022774b90ccc234e1   
download/lirc-0.8.4a-remove_smp_unsafe_drivers.patch

  5a274e4eaff8156b17903c22ea01f506  download/lirc-0.8.5.tar.bz2
-d6256f60bc45a9a5b6da30dd9eac2d24  download/lirc-0.8.5-lircmd_uinput.patch
+138e3e15bff1ea35dc577af721ff742f  download/lirc-0.8.5-lircmd_uinput.patch
  0c6e1197f1cced83070509d56d24360c   
download/lirc-0.8.5-mceusb2_mod_mce_0.2.0.patch
  e13b18b563136e8c50f490df4ef9250d  download/lirc-0.8.5-no_python.patch
  e734f494fc683e9e6f3335c212c980af   
download/lirc-0.8.5-remove_smp_unsafe_drivers.patch

Modified:  
trunk/gar-minimyth/script/system/lirc/files/lirc-0.8.5-lircmd_uinput.patch
==============================================================================
---  
trunk/gar-minimyth/script/system/lirc/files/lirc-0.8.5-lircmd_uinput.patch      
 
(original)
+++  
trunk/gar-minimyth/script/system/lirc/files/lirc-0.8.5-lircmd_uinput.patch      
 
Wed Jun  3 20:45:04 2009
@@ -1,6 +1,6 @@
  diff -Naur lirc-0.8.5-old/daemons/lircmd.c lirc-0.8.5-new/daemons/lircmd.c
  --- lirc-0.8.5-old/daemons/lircmd.c   2006-10-09 00:22:14.000000000 -0700
-+++ lirc-0.8.5-new/daemons/lircmd.c    2009-06-02 17:30:53.000000000 -0700
++++ lirc-0.8.5-new/daemons/lircmd.c    2009-06-03 20:39:25.000000000 -0700
  @@ -32,6 +32,12 @@
   #include <sys/socket.h>
   #include <sys/un.h>
@@ -24,9 +24,19 @@
   inline int map_buttons(int b)
   {
        switch(b)
-@@ -165,6 +174,13 @@
- {
-       /* not safe in a signal handler *//*freetm(tm_first);*/
+@@ -167,9 +176,21 @@
+       
+       shutdown(lircd,2);
+       close(lircd);
+-      shutdown(lircm,2);
+-      close(lircm);
++
++      if(uinputfd != -1)
++      {
++              shutdown(lircm,2);
++              close(lircm);
++              lircm = -1;
++      }
        
  +     if(uinputfd != -1)
  +     {
@@ -35,10 +45,10 @@
  +             uinputfd = -1;
  +     }
  +
-       shutdown(lircd,2);
-       close(lircd);
-       shutdown(lircm,2);
-@@ -217,6 +233,88 @@
+       signal(sig,SIG_DFL);
+       raise(sig);
+ }
+@@ -217,6 +238,89 @@
   }
   #endif /* DAEMONIZE */

@@ -49,6 +59,7 @@
  +     int key;
  +     struct uinput_user_dev dev;
  +     
++      /* Open a uinput device. */
  +     fd = open("/dev/input/uinput", O_RDWR);
  +     if(fd == -1)
  +     {
@@ -73,22 +84,25 @@
  +             goto setup_error;
  +     }
  +
++      /* Configure support for the left, right and middle mouse buttons. */
  +     if( (ioctl(fd, UI_SET_EVBIT , EV_KEY    ) != 0) ||
-+            (ioctl(fd, UI_SET_KEYBIT, BTN_LEFT  ) != 0) ||
-+            (ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE) != 0) ||
-+            (ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT ) != 0) )
-+        {
++          (ioctl(fd, UI_SET_KEYBIT, BTN_LEFT  ) != 0) ||
++          (ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE) != 0) ||
++          (ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT ) != 0) )
++      {
  +             goto setup_error;
  +     }
  +
++      /* Configure support for the relative mouse location and scroll wheel */
  +     if( (ioctl(fd, UI_SET_EVBIT , EV_REL   ) != 0) ||
-+            (ioctl(fd, UI_SET_RELBIT, REL_X    ) != 0) ||
-+            (ioctl(fd, UI_SET_RELBIT, REL_Y    ) != 0) ||
-+            (ioctl(fd, UI_SET_RELBIT, REL_WHEEL) != 0) )
-+        {
++          (ioctl(fd, UI_SET_RELBIT, REL_X    ) != 0) ||
++          (ioctl(fd, UI_SET_RELBIT, REL_Y    ) != 0) ||
++          (ioctl(fd, UI_SET_RELBIT, REL_WHEEL) != 0) )
++      {
  +             goto setup_error;
-+        }
++      }
  +
++      /* Register the device with the input subsystem. */
  +     if(ioctl(fd, UI_DEV_CREATE) != 0)
  +     {
  +             goto setup_error;
@@ -103,23 +117,20 @@
  +     return -1;
  +}
  +
-+int usend(__u16 type, __u16 code, __s32 value)
++int write_uinput(__u16 type, __u16 code, __s32 value)
  +{
  +#ifdef __linux__
-+      if(uinputfd != -1)
-+      {
-+              struct input_event event;
++      struct input_event event;
  +
-+              memset(&event, 0, sizeof(event));
-+              event.type = type;
-+              event.code = code;
-+              event.value = value;
++      memset(&event, 0, sizeof(event));
++      event.type = type;
++      event.code = code;
++      event.value = value;
  +
-+              if(write(uinputfd, &event, sizeof(event)) != sizeof(event))
-+              {
-+                      fprintf(stderr,"%s: writing to uinput 
failed\n",progname);
-+                      perror(progname);
-+              }
++      if(write(uinputfd, &event, sizeof(event)) != sizeof(event))
++      {
++              fprintf(stderr,"%s: writing to uinput failed\n",progname);
++              perror(progname);
  +     }
  +#endif
  +}
@@ -127,56 +138,75 @@
   void msend(int dx,int dy,int dz,int rep,int buttp,int buttr)
   {
        static int buttons=0;
-@@ -290,6 +388,48 @@
+@@ -290,6 +394,67 @@
                }
                break;
        }
  +
-+      if((dx != 0) || (dy != 0))
-+      {
-+              usend(EV_REL, REL_X, dx);
-+              usend(EV_REL, REL_Y, dy);
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+        if(dz != 0)
-+      {
-+              usend(EV_REL, REL_WHEEL, dz);
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttp == BUTTON1)
-+      {
-+              usend(EV_KEY, BTN_LEFT, 1 );
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttr == BUTTON1)
-+      {
-+              usend(EV_KEY, BTN_LEFT, 0 );
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttp == BUTTON2)
-+      {
-+              usend(EV_KEY, BTN_MIDDLE, 1);
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttr == BUTTON2)
-+      {
-+              usend(EV_KEY, BTN_MIDDLE, 0);
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttp == BUTTON3)
-+      {
-+              usend(EV_KEY, BTN_RIGHT, 1);
-+              usend(EV_SYN, SYN_REPORT, 0);
-+      }
-+      if(buttr == BUTTON3)
++      if(uinputfd != -1)
  +     {
-+              usend(EV_KEY, BTN_RIGHT, 0);
-+              usend(EV_SYN, SYN_REPORT, 0);
++              int f=1;
++              if(rep>=ms.acc_start)
++              {
++                      if(rep*ms.acc_fak>=ms.acc_max)
++                      {
++                              f=ms.acc_max;
++                      }
++                      else
++                      {
++                              f=rep*ms.acc_fak;
++                      }
++              }
++              while(f>0)
++              {
++                      f--;
++                      if((dx != 0) || (dy != 0))
++                      {
++                              write_uinput(EV_REL, REL_X, dx);
++                              write_uinput(EV_REL, REL_Y, dy);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(dz != 0)
++                      {
++                              write_uinput(EV_REL, REL_WHEEL, dz);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttp&BUTTON1)
++                      {
++                              write_uinput(EV_KEY, BTN_LEFT, 1);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttr&BUTTON1)
++                      {
++                              write_uinput(EV_KEY, BTN_LEFT, 0);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttp&BUTTON2)
++                      {
++                              write_uinput(EV_KEY, BTN_MIDDLE, 1);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttr&BUTTON2)
++                      {
++                              write_uinput(EV_KEY, BTN_MIDDLE, 0);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttp&BUTTON3)
++                      {
++                              write_uinput(EV_KEY, BTN_RIGHT, 1);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++                      if(buttr&BUTTON3)
++                      {
++                              write_uinput(EV_KEY, BTN_RIGHT, 0);
++                              write_uinput(EV_SYN, SYN_REPORT, 0);
++                      }
++              }
  +     }
   }

   void mouse_move(int dx,int dy,int dz,int rep)
-@@ -725,6 +865,9 @@
+@@ -725,6 +890,9 @@
                        {"help",no_argument,NULL,'h'},
                        {"version",no_argument,NULL,'v'},
                        {"nodaemon",no_argument,NULL,'n'},
@@ -186,7 +216,7 @@
                        {0, 0, 0, 0}
                };
                c = getopt_long(argc,argv,"hvn",long_options,NULL);
-@@ -737,6 +880,9 @@
+@@ -737,6 +905,9 @@
                        printf("\t -h --help\t\tdisplay this message\n");
                        printf("\t -v --version\t\tdisplay version\n");
                        printf("\t -n --nodaemon\t\tdon't fork to 
background\n");
@@ -196,7 +226,7 @@
                        return(EXIT_SUCCESS);
                case 'v':
                        printf("%s %s\n",progname,VERSION);
-@@ -744,6 +890,11 @@
+@@ -744,6 +915,11 @@
                case 'n':
                        nodaemon=1;
                        break;
@@ -208,15 +238,61 @@
                default:
                        printf("Usage: %s [options] [config-file]\n",progname);
                        return(EXIT_FAILURE);
-@@ -817,6 +968,12 @@
+@@ -777,25 +953,37 @@
+               exit(EXIT_FAILURE);
+       };
+
+-      /* open fifo */
+-      
+-      if(mkfifo(LIRCM,0644)==-1)
++      /* either create uinput device or fifo device */
++      uinputfd = -1;
++      lircm = -1;
++      if(useuinput)
        {
-               ms=new_ms;
-       }
+-              if(errno!=EEXIST)
++              /* create uinput device */
  +
-+      if(useuinput)
-+      {
  +             uinputfd = setup_uinputfd(progname);
  +     }
++      else
++      {
++              /* open fifo */
++
++              if(mkfifo(LIRCM,0644)==-1)
+               {
+-                      fprintf(stderr,"%s: could not create fifo\n",progname);
++                      if(errno!=EEXIST)
++                      {
++                              fprintf(stderr,"%s: could not create 
fifo\n",progname);
++                              perror(progname);
++                              exit(EXIT_FAILURE);
++                      }
++              }
++      
++              lircm=open(LIRCM,O_RDWR|O_NONBLOCK);
++              if(lircm==-1)
++              {
++                      fprintf(stderr,"%s: could not open fifo\n",progname);
+                       perror(progname);
+                       exit(EXIT_FAILURE);
+               }
+       }
+-      
+-      lircm=open(LIRCM,O_RDWR|O_NONBLOCK);
+-      if(lircm==-1)
+-      {
+-              fprintf(stderr,"%s: could not open fifo\n",progname);
+-              perror(progname);
+-              exit(EXIT_FAILURE);
+-      }
+
+       /* read config file */
+
+@@ -817,6 +1005,7 @@
+       {
+               ms=new_ms;
+       }
  +
   #ifdef DAEMONIZE
        if(!nodaemon) daemonize();

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"minimyth-commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/minimyth-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to