Ubuntu – Pen tablet/ MousePen doesn’t work in Ubuntu

driversmousepatchtablet

My problem is almost same as in here & bug 1391260

Genius MousePen i608X doesn't work in Ubuntu

My OS is Ubuntu 14.10. The pointer moves, but no button is sensing.

It seems to share the same magic HID of the other
tablets of this vendor

Can I have a step by step procedure of downloading and installing the patch file?

Edit: After I upgraded the linux kernel version to 3.18.3-031803-generic, Genius MousePen i608X is working well.

Best Answer

  • This might not be the correct procedure but I managed to get it to work. I'll post it and you can do it if you're feeling adventurous.

    There are two ways I did this but I can't guarantee that they will work for you simply because I still consider myself a newbie and I did this by following other people's guides.

    WARNING: This includes compiling a custom kernel.Make sure to have at least one or more older kernels installed just in case something goes wrong!


    First (easy) way:

    1. Download the kernel source from The Linux Kernel Archives. Just click on the "Latest stable kernel" button.
    2. Extract the archive: open the terminal and navigate to where you downloaded the kernel and run this command: tar -xvJf linux-"KernelVersion".tar.xz (replace "KernelVersion" with the version number of the downloaded kernel).
    3. This will create a new folder usually named linux-"KernelVersion" (again, this is the version number of the downloaded kernel). Enter that folder, then navigate to drivers > hid. You should now be in /path/to/download/linux-"KernelVersion"/drivers/hid.
    4. Edit the hid-ids.h file with your favourite text editor: gedit hid-ids.h or nano hid-ids.h or kate hid-ids.h
    5. In the text editor, navigate to the line that says (should be around line 520-530):

      #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011

    6. Edit the line so it looks like this:

      #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x501a

    7. Save and exit. Now it's time to compile the kernel.

    You can find many guides for compiling the kernel online, so I think it would be better to refer you to one than to write the guide myself. I found this article most helpful. Read the article carefully and be careful about the configuration.

    With this fix, everything worked perfectly, the only thing bugging me was that xinput now listed several Genius MousePen i608X devices.


    Second (hard) way:

    This way is harder in the sense that you will have to edit few more files. This is the way described in the patch you mention.

    1. Follow steps 1 - 3 from the first way.
    2. Edit the hid-core.c file like this:

    Navigate to the chunk of code that looks like this: { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) },

    And change it to this: { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, //add this { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) },

    1. Edit the hid-ids.h similarly to the first way, but instead of editing that one line, add this line after it:

    #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501A

    1. Edit the hid-kye.c file like this:

    Find this chunk of code:

    /*
     * See EasyPen M610X description, device and HID report descriptors at
     * http://sf.net/apps/mediawiki/digimend/?title=KYE_EasyPen_M610X
     */
    

    and before it, add this:

    /* Original MousePen i608X report descriptor size */
    #define MOUSEPEN_I608X_2_RDESC_ORIG_SIZE  482
    
    /* Fixed MousePen i608X report descriptor */
    static __u8 mousepen_i608x_2_rdesc_fixed[] = {
      0x06, 0x00, 0xFF, /*  Usage Page (FF00h),             */
      0x09, 0x01,       /*  Usage (01h),                    */
      0xA1, 0x01,       /*  Collection (Application),       */
      0x85, 0x05,       /*    Report ID (5),                */
      0x09, 0x01,       /*    Usage (01h),                  */
      0x15, 0x80,       /*    Logical Minimum (-128),       */
      0x25, 0x7F,       /*    Logical Maximum (127),        */
      0x75, 0x08,       /*    Report Size (8),              */
      0x95, 0x07,       /*    Report Count (7),             */
      0xB1, 0x02,       /*    Feature (Variable),           */
      0xC0,             /*  End Collection,                 */
      0x05, 0x0D,       /*  Usage Page (Digitizer),         */
      0x09, 0x02,       /*  Usage (Pen),                    */
      0xA1, 0x01,       /*  Collection (Application),       */
      0x85, 0x10,       /*    Report ID (16),               */
      0x09, 0x20,       /*    Usage (Stylus),               */
      0xA0,             /*    Collection (Physical),        */
      0x14,             /*      Logical Minimum (0),        */
      0x25, 0x01,       /*      Logical Maximum (1),        */
      0x75, 0x01,       /*      Report Size (1),            */
      0x09, 0x42,       /*      Usage (Tip Switch),         */
      0x09, 0x44,       /*      Usage (Barrel Switch),      */
      0x09, 0x46,       /*      Usage (Tablet Pick),        */
      0x95, 0x03,       /*      Report Count (3),           */
      0x81, 0x02,       /*      Input (Variable),           */
      0x95, 0x04,       /*      Report Count (4),           */
      0x81, 0x03,       /*      Input (Constant, Variable), */
      0x09, 0x32,       /*      Usage (In Range),           */
      0x95, 0x01,       /*      Report Count (1),           */
      0x81, 0x02,       /*      Input (Variable),           */
      0x75, 0x10,       /*      Report Size (16),           */
      0x95, 0x01,       /*      Report Count (1),           */
      0xA4,             /*      Push,                       */
      0x05, 0x01,       /*      Usage Page (Desktop),       */
      0x55, 0xFD,       /*      Unit Exponent (-3),         */
      0x65, 0x13,       /*      Unit (Inch),                */
      0x34,             /*      Physical Minimum (0),       */
      0x09, 0x30,       /*      Usage (X),                  */
      0x46, 0x40, 0x1F, /*      Physical Maximum (8000),    */
      0x26, 0x00, 0xA0, /*      Logical Maximum (40960),    */
      0x81, 0x02,       /*      Input (Variable),           */
      0x09, 0x31,       /*      Usage (Y),                  */
      0x46, 0x70, 0x17, /*      Physical Maximum (6000),    */
      0x26, 0x00, 0x78, /*      Logical Maximum (30720),    */
      0x81, 0x02,       /*      Input (Variable),           */
      0xB4,             /*      Pop,                        */
      0x09, 0x30,       /*      Usage (Tip Pressure),       */
      0x26, 0xFF, 0x07, /*      Logical Maximum (2047),     */
      0x81, 0x02,       /*      Input (Variable),           */
      0xC0,             /*    End Collection,               */
      0xC0,             /*  End Collection,                 */
      0x05, 0x01,       /*  Usage Page (Desktop),           */
      0x09, 0x02,       /*  Usage (Mouse),                  */
      0xA1, 0x01,       /*  Collection (Application),       */
      0x85, 0x11,       /*    Report ID (17),               */
      0x09, 0x01,       /*    Usage (Pointer),              */
      0xA0,             /*    Collection (Physical),        */
      0x14,             /*      Logical Minimum (0),        */
      0xA4,             /*      Push,                       */
      0x05, 0x09,       /*      Usage Page (Button),        */
      0x75, 0x01,       /*      Report Size (1),            */
      0x19, 0x01,       /*      Usage Minimum (01h),        */
      0x29, 0x03,       /*      Usage Maximum (03h),        */
      0x25, 0x01,       /*      Logical Maximum (1),        */
      0x95, 0x03,       /*      Report Count (3),           */
      0x81, 0x02,       /*      Input (Variable),           */
      0x95, 0x05,       /*      Report Count (5),           */
      0x81, 0x01,       /*      Input (Constant),           */
      0xB4,             /*      Pop,                        */
      0x95, 0x01,       /*      Report Count (1),           */
      0xA4,             /*      Push,                       */
      0x55, 0xFD,       /*      Unit Exponent (-3),         */
      0x65, 0x13,       /*      Unit (Inch),                */
      0x34,             /*      Physical Minimum (0),       */
      0x75, 0x10,       /*      Report Size (16),           */
      0x09, 0x30,       /*      Usage (X),                  */
      0x46, 0x40, 0x1F, /*      Physical Maximum (8000),    */
      0x26, 0x00, 0x50, /*      Logical Maximum (20480),    */
      0x81, 0x02,       /*      Input (Variable),           */
      0x09, 0x31,       /*      Usage (Y),                  */
      0x46, 0x70, 0x17, /*      Physical Maximum (6000),    */
      0x26, 0x00, 0x3C, /*      Logical Maximum (15360),    */
      0x81, 0x02,       /*      Input (Variable),           */
      0xB4,             /*      Pop,                        */
      0x75, 0x08,       /*      Report Size (8),            */
      0x09, 0x38,       /*      Usage (Wheel),              */
      0x15, 0xFF,       /*      Logical Minimum (-1),       */
      0x25, 0x01,       /*      Logical Maximum (1),        */
      0x81, 0x06,       /*      Input (Variable, Relative), */
      0x81, 0x01,       /*      Input (Constant),           */
      0xC0,             /*    End Collection,               */
      0xC0              /*  End Collection                  */
    };
    
    1. In the same file find this chunk of code:
    case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
          if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) {
              rdesc = mousepen_i608x_rdesc_fixed;
              *rsize = sizeof(mousepen_i608x_rdesc_fixed);
          }
          break;
    

    and add this after it:

    case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2:
          if (*rsize == MOUSEPEN_I608X_2_RDESC_ORIG_SIZE) {
              rdesc = mousepen_i608x_2_rdesc_fixed;
              *rsize = sizeof(mousepen_i608x_2_rdesc_fixed);
          }
          break;
    
    1. In the same file find this chunk of code:
    case USB_DEVICE_ID_KYE_EASYPEN_I405X:
      case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
      case USB_DEVICE_ID_KYE_EASYPEN_M610X:
    

    and change it to this:

    case USB_DEVICE_ID_KYE_EASYPEN_I405X:
      case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
      case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: // add this line
      case USB_DEVICE_ID_KYE_EASYPEN_M610X:
    
    1. In the same file find this chunk of code:
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_KYE_EASYPEN_M610X) },
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
    

    and change it to this:

      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,                // add this line
                  USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, // and this one
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_KYE_EASYPEN_M610X) },
      { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
                  USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
    
    1. The last file to edit is in /path/to/download/linux-"KernelVersion"/drivers/hid/usbhid directory. It's called hid-quirks.c. Inside of it find this chunk of code:

        { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
      

      and change it to this:

      { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT },
      { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS },
      { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT },
      { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, // add this line
      { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT },
      { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
      { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
    
    1. Remember to save all the files after editing. Now you can compile the kernel as mentioned above.

    Again, this might not be the correct way to do this, but since I didn't find the tutorial how to do it properly, I had to do it manually. It worked for me, but, again, I can't guarantee that it will work for you. Hope this helps you.

  • Related Question