#4260 NORM First D: evdev_drv does not work with GS in absolute mode

Zarro Boogs per Child bugtracker at laptop.org
Wed Oct 17 16:36:11 EDT 2007


#4260: evdev_drv does not work with GS in absolute mode
---------------------+------------------------------------------------------
  Reporter:  bernie  |       Owner:  bernie                
      Type:  defect  |      Status:  new                   
  Priority:  normal  |   Milestone:  First Deployment, V1.0
 Component:  distro  |     Version:                        
Resolution:          |    Keywords:                        
  Verified:  0       |  
---------------------+------------------------------------------------------

Comment(by bernie):

 After a quick exchange on IRC with Mercury, I now totally understand this
 issue.

 What really fixed the described bug was making relative mode the default
 in evde, with a separate patch I didn't mention.

 We need the kernel patch only to convince hal into flagging the device as
 a mouse.

 This is what hal does to detect a mouse:

 {{{
 static void
 input_test_rel (HalDevice *d, const char *sysfs_path)
 {
     char *s;
     long bitmask[NBITS(REL_MAX)];
     int num_bits;

     s = hal_util_get_string_from_file (sysfs_path, "capabilities/rel");
     if (s == NULL)
         goto out;

     num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

     /* TODO: this test can be improved */
     if (test_bit (REL_X, bitmask) && test_bit (REL_Y, bitmask)) {
         hal_device_add_capability (d, "input.mouse");
     }
 out:
     ;
 }
 }}}

 and this is what hal wants for a touchpad:

 {{{
 static void
 input_test_abs (HalDevice *d, const char *sysfs_path)
 {
     char *s;
     long bitmask[NBITS(ABS_MAX)];
     int num_bits;

     s = hal_util_get_string_from_file (sysfs_path, "capabilities/abs");
     if (s == NULL)
         goto out;
     num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

     if (test_bit (ABS_X, bitmask) && test_bit (ABS_Y, bitmask) && test_bit
 (ABS_PRESSURE, bitmask)) {
         hal_device_add_capability (d, "input.touchpad");
                 goto out;
         }

         /* TODO: Hmm; this code looks sketchy... why do we do !test_bit on
 the Y axis ?? */
     if (test_bit(ABS_X, bitmask) && !test_bit(ABS_Y, bitmask)) {
         long bitmask_touch[NBITS(KEY_MAX)];

         hal_device_add_capability (d, "input.joystick");

         s = hal_util_get_string_from_file (sysfs_path,
 "capabilities/key");
         if (s == NULL)
             goto out;
         input_str_to_bitmask (s, bitmask_touch, sizeof (bitmask_touch));

         if (test_bit(BTN_TOUCH, bitmask_touch)) {
             hal_device_add_capability (d, "input.tablet");
                 }
     }
 out:
     ;
 }
 }}}

 Note how it also tests for pressure, which the PT does not provide.
 Removing the extra check for pressure will make touchpads and joysticks
 look alike.  So to tell them apart we need to find out what extra buttons
 joysticks usually provide that touchpads don't.

-- 
Ticket URL: <https://dev.laptop.org/ticket/4260#comment:2>
One Laptop Per Child <https://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list