Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: usb composite devices ( mouse and gamepad )

  1. #11
    Join Date
    Oct 2007
    Beans
    139

    Re: usb composite devices ( mouse and gamepad )

    Perfect, so is this the problem?

    Event code 320 (ToolPen)
    Event code 321 (ToolRubber)
    Event code 322 (ToolBrush)
    Event code 323 (ToolPencil)
    Event code 324 (ToolAirbrush)
    Event code 325 (ToolFinger)
    Event code 326 (ToolMouse)
    Event code 327 (ToolLens)

    I dont put any of that im my mouse descriptor that I know of.

    Not sure you know much about the usb firmware side of things but this is my mouse part of the descriptor. As you can tell by the comments there is nothing more then a pointer and a wheel and buttons. So what does the kernel have beef with?

    Code:
    	0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
        0x09, 0x02,                    // USAGE (Mouse)
        0xa1, 0x01,                    // COLLECTION (Application)
    	0x85, 0x09, 				   // Report ID (1) 
        0x09, 0x01,                    //   USAGE (Pointer)
        0xA1, 0x00,                    //   COLLECTION (Physical)
        0x05, 0x09,                    //     USAGE_PAGE (Button)
        0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
        0x29, 0x03,                    //     USAGE_MAXIMUM (Button 3)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
        0x75, 0x01,                    //     REPORT_SIZE (1)
        0x95, 0x03,                    //     REPORT_COUNT (3)
        0x81, 0x02,                    //     INPUT (Data,Var,Abs)
        0x75, 0x01,                    //     REPORT_SIZE (1)
        0x95, 0x05,                    //     REPORT_COUNT (5)
        0x81, 0x03,                    //     INPUT (Cnst,Var,Abs)
    
        0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
        0x09, 0x30,                    //     USAGE (X)
        0x09, 0x31,                    //     USAGE (Y)
    	//0x09, 0x38,                    //     USAGE (Wheel)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x25, 0x00, 0x04,              //     LOGICAL_MAXIMUM (1k)
        0x75, 0x08,                    //     REPORT_SIZE (16)
        0x95, 0x02,                    //     REPORT_COUNT (2)
    	0x81, 0x06,                    //     INPUT (Data,Var,Rel)
        0xC0,                          //   END_COLLECTION
        0xC0                          // END COLLECTION
    Last edited by ulao; February 9th, 2012 at 06:21 AM.

  2. #12
    Join Date
    Sep 2007
    Beans
    144

    Re: usb composite devices ( mouse and gamepad )

    Quote Originally Posted by ulao View Post
    Perfect, so is this the problem?
    Only this one is actually checked:

    Event code 320 (ToolPen)

    But not having the others Tool* ones there as well would certainly be more clean.

    Not sure you know much about the usb firmware side of things but this is my mouse part of the descriptor. As you can tell by the comments there is nothing more then a pointer and a wheel. So what does the kernel have beef with?
    I think the problem is simply that there are to many buttons on the device. The kernel starts at 303 and then goes up to 327 with the button ids, inbetween is ToolPen and causing problems.

    Looking at linux-source-3.0.0/drivers/hid/hid-input.c shows this piece of code:
    Code:
            case HID_UP_BUTTON:
                    code = ((usage->hid - 1) & HID_USAGE);
    
                    switch (field->application) {
                    case HID_GD_MOUSE:
                    case HID_GD_POINTER:  code += BTN_MOUSE; break;
                    case HID_GD_JOYSTICK:
                                    if (code <= 0xf)
                                            code += BTN_JOYSTICK;
                                    else
                                            code += BTN_TRIGGER_HAPPY;
                                    break;
                    case HID_GD_GAMEPAD:  code += BTN_GAMEPAD; break;
                    default:
    This looks like a bug in the Kernel. For Usage Page Joystick it correctly uses BTN_TRIGGER_HAPPY, so it doesn't run into conflicts with other buttons, but for Usage Page Gamepad it just overflows into the other button names which leads to the given conflict. So it looks like Linux currently can only handle 16 buttons for gamepads properly, as after that it will overflow and run into the tablet buttons leading to conflicts.

    Is your device supposed to have 30 buttons? And if so, would it be possible to break them up into multiple separate HID devices (i.e. one for mouse, one for joystick, etc.) instead of having it all in one?

  3. #13
    Join Date
    Oct 2007
    Beans
    139

    Re: usb composite devices ( mouse and gamepad )

    well here are my buttons


    Event code 304 (BtnA) HID 0
    Event code 305 (BtnB) HID 1
    Event code 306 (BtnC) HID 2
    Event code 307 (BtnX) HID 3
    Event code 308 (BtnY) HID 4
    Event code 309 (BtnZ) HID 5
    Event code 310 (BtnTL) HID 6
    Event code 311 (BtnTR) HID 7 ( first row )
    Event code 312 (BtnTL2) HID 8
    Event code 313 (BtnTR2) HID 9
    Event code 314 (BtnSelect) HID 10
    Event code 315 (BtnStart) HID 11
    Event code 316 (BtnMode) HID 12
    Event code 317 (BtnThumbL) HID 13
    Event code 318 (BtnThumbR) HID 14
    Event code 319 (?) HID 15 ( second row )

    but for some reason its a '?' and I'm told by xboxdrv that that is not an event key. if I watch it from the event I see this
    Event: time 1328761901.985525, type 1 (Key), code 319 (?), value 0

    I should have one more row but I only use 3 of the buttons, however in the descriptor I tell it there is another row. In total it would be 24.

    I can not finish mapping because of the ? thing which is really unfortunate. Kind of makes me wonder what BTN_DEAD is, since my first HID is A 304 not 303.
    Last edited by ulao; February 9th, 2012 at 06:27 AM.

  4. #14
    Join Date
    Sep 2007
    Beans
    144

    Re: usb composite devices ( mouse and gamepad )

    Quote Originally Posted by ulao View Post
    Event code 319 (?) HID 15 ( second row )
    Use KEY_#319 for that.

  5. #15
    Join Date
    Oct 2007
    Beans
    139

    Re: usb composite devices ( mouse and gamepad )

    ah I tried to use the number somehow... thx for that! So this works as a good temp fix for me, any idea how to get the code fixed?
    Obviously I need this

    Code:
     case HID_UP_BUTTON:
                    code = ((usage->hid - 1) & HID_USAGE);
    
                    switch (field->application) {
                    case HID_GD_MOUSE:
                    case HID_GD_POINTER:  code += BTN_MOUSE; break;
                    case HID_GD_JOYSTICK:
                    case HID_GD_GAMEPAD:  code += BTN_GAMEPAD; 
                                    if (code <= 0xf)
                                            code += BTN_JOYSTICK;
                                    else
                                            code += BTN_TRIGGER_HAPPY;
                                    break;
                    default:
    so how do I make sure its in the next release or so? Also, how does one recompile kernels? Do I have to do all of this?
    https://help.ubuntu.com/community/Kernel/Compile
    Last edited by ulao; February 9th, 2012 at 04:41 PM.

  6. #16
    Join Date
    Sep 2007
    Beans
    144

    Re: usb composite devices ( mouse and gamepad )

    Quote Originally Posted by ulao View Post
    So this works as a good temp fix for me, any idea how to get the code fixed?
    http://www.kernel.org/doc/Documentat...mittingPatches

    Never been through the process myself.

    Obviously I need this
    Not quite. That code snipped has bugs, more like:

    Code:
            case HID_UP_BUTTON:
                    code = ((usage->hid - 1) & HID_USAGE);
    
                    switch (field->application) {
                    case HID_GD_MOUSE:
                    case HID_GD_POINTER:  code += BTN_MOUSE; break;
                    case HID_GD_JOYSTICK:
                                    if (code <= 0xf)
                                            code += BTN_JOYSTICK;
                                    else
                                            code += BTN_TRIGGER_HAPPY;
                                    break;
                    case HID_GD_GAMEPAD:
                                    if (code <= 0xf)
                                            code += BTN_GAMEPAD;
                                    else
                                            code += BTN_TRIGGER_HAPPY;
                                    break;
                    default:
    Don't know enough about HID to tell if thats the cleanest way to fix it or if there are potential naming conflicts with joysticks and gamepads sharing the TriggerHappy buttons.

    so how do I make sure its in the next release or so? Also, how does one recompile kernels? Do I have to do all of this?
    More or less. Haven't compiled a kernel myself in a long long while.
    Last edited by Grumbel; February 9th, 2012 at 04:57 PM.

  7. #17
    Join Date
    Oct 2007
    Beans
    139

    Re: usb composite devices ( mouse and gamepad )

    ok, thx for the help. Does ubuntu have a means to submit bugs easily?

  8. #18
    Join Date
    Sep 2007
    Beans
    144

    Re: usb composite devices ( mouse and gamepad )

    Quote Originally Posted by ulao View Post
    ok, thx for the help. Does ubuntu have a means to submit bugs easily?
    Yes:

    https://bugs.launchpad.net/ubuntu/+s...linux/+filebug

    Going through upstream might however be faster.

  9. #19
    Join Date
    Oct 2007
    Beans
    139

    Re: usb composite devices ( mouse and gamepad )

    ok submitted in Bug #929694

    Not sure what you meant by upstream?

  10. #20
    Join Date
    Sep 2007
    Beans
    144

    Re: usb composite devices ( mouse and gamepad )

    Quote Originally Posted by ulao View Post
    Not sure what you meant by upstream?
    The term "upstream" refers to the people who originally write the software (i.e. the kernel developers), as opposet to Ubuntu who just takes the software and then distributes it in packaged form, but isn't actually writing it.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •