• AVR Freaks

MOUSE HID / Resolution problem

Author
tulclint
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2010/02/23 01:22:13
  • Location: 0
  • Status: offline
2010/02/28 23:58:09 (permalink)
0

MOUSE HID / Resolution problem

Good Day to all!
I've been working on PIC18F2550 mouse. I've edited the descriptor on the" Mouse on a circle demo" so that i could have logical minimum of 0 and max = 255, I'm sending an absolute coordinate. The problem is when I send X and Y data greater than 0x7F (127 dec), the mouse PC wouldn't respond. But when I send x=0x7F and y=0x7F. The cursor moves to the lower right area of the monitor which suggest the 127 is the highest value I could send.

I would like to increase the resolution of my mouse.
I'm thinking the if I have a screen resolution of 1280 x 1024. So 1280/127 = 10...? So my PIC mouse would move at a distance of 10 pixels at a time?




ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
{0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x02, /* Usage (Mouse) */
0xA1, 0x01, /* Collection (Application) */
0x09, 0x01, /* Usage (Pointer) */
0xA1, 0x00, /* Collection (Physical) */
0x05, 0x09, /* Usage Page (Buttons) */
0x19, 0x01, /* Usage Minimum (01) */
0x29, 0x03, /* Usage Maximum (03) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (0) */
0x95, 0x03, /* Report Count (3) */
0x75, 0x01, /* Report Size (1) */
0x81, 0x02, /* Input (Data, Variable, Absolute) */
0x95, 0x01, /* Report Count (1) */
0x75, 0x05, /* Report Size (5) */
0x81, 0x01, /* Input (Constant) ;5 bit padding */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x15, 0x00, /* Logical Minimum (-127)0x81, 0x00 0 */
0x26, 0xFF,0x00, /* logical Maximum 0x25 (127)0x7f, (255) 0xff 0x00 */
0x75, 0x08, /* Report Size (8) */
0x95, 0x02, /* Report Count (2) */
0x81, 0x02, /* Input (Data, Variable, Relative) 0x06 orig 02-absolute */
0xC0, 0xC0}
};/* End Collection,End Collection */




Thanks,
tulclint
#1

11 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/01 06:00:58 (permalink)
    0
    OS determines the scaling factor of mouse cursor movement (screen pixels / mouse notch).
    It is tuned by user, PC by PC.

    For Windows, set the scaling factor on the mouse control panel on your PC.
    Control Panel - Mouse - Pointer Options - Speed
    - Scaling slider
    - High-resolution check box



    If your mouse device is too more sensitive than other commercial mouse,
    increase the bInterval value on the endpoint descriptor.
    Greater interval slows down report frequency, that is, mouse speed.

    This is an excerption from Microchip mouse example (v2.6)

    usb_descriptors.c

    /* Configuration 1 Descriptor */
    ROM BYTE configDescriptor1[]={
    ...
    ...
    ...
    /* Endpoint Descriptor */
    0x07,/*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
    HID_EP | _EP_IN, //EndpointAddress
    _INTERRUPT, //Attributes
    DESC_CONFIG_WORD(3), //size
    0x01 //Interval <--------------
    };


    1 ms (0x01) interval is too frequent for mouse. Most of commercial mouse is implemented in Low-speed, though Microchip one is in Full-speed. 10 (8) - 20 (16) ms is better.

    Tsuneo
    post edited by chinzei - 2010/03/01 06:23:17
    #2
    tulclint
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2010/02/23 01:22:13
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/02 01:16:02 (permalink)
    0
    Thanks Tsuneo....

    I'm still a little bit confused since I'm sending an absolute coordinate instead of a relative. Sending x=y=0x7F, moves the mouse pointer to the lower right of the screen.
    I'm guessing that (screen pixels/mouse notch) is only applicable when sending a relative coordinate?


    Thanks,
    Clint
    #3
    tulclint
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2010/02/23 01:22:13
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/02 04:51:15 (permalink)
    0
    Finally got it....
    Added Physical limits....
    Set both Physical and Logical minimum, maximum to 0 and 1024 respectively. Resolution is almost perfect for my screen.


    0x09, 0x30, /* Usage (X) */
    0x09, 0x31, /* Usage (Y) */
    0x35, 0x00, /* Physical minimum = 0 */
    0x46, 0xFF,0x03, /*Physical minimum = 1023*/
    0x15, 0x00, /* Logical Minimum = 0 */
    0x26, 0xFF,0x03, /* logical Maximum = 1023 */
    0x75, 0x10, /* Report Size (16) */
    0x95, 0x02, /* Report Count (2) */
    0x81, 0x02, /* Input (Data, Variable, Relative) 0x06 orig 02-absolute */
    0xC0, 0xC0}



    thanks,
    tulclint
    post edited by tulclint - 2010/03/02 04:53:18
    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/02 06:24:11 (permalink)
    0
    Ah, absolute mouse.
    I mistook it as a usual relative mouse.
    I have not fiddled absolute mouse so much, but reminding digitizer case.

    Added Physical limits....
    Set both Physical and Logical minimum, maximum to 0 and 1024 respectively.

    If the Logical Min/Max define non-negative range, for example, Min/Max = (0, 1023),
    does it run without Physical Min/Max?

    Physical Min/Max define scaling and offset of the logical vaule.
    When the range of Physical Min/Max matches to Logical one, we can do without Physical one.
    Rather, I suppose non-negative range is the point.

    OR

    Adding UNIT (Inches) usage, the axis value is scaled into DPI
    For example, for 96 DPI, 10 inches
    Logical Min/Max: (0, 960)
    Physical Min/Max: (0, 10)
    Unit : Inches

    Tsuneo
    #5
    tulclint
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2010/02/23 01:22:13
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/08 20:03:39 (permalink)
    0
    Thanks Tsuneo...
    Sorry for my late reply I was busy with proceeding with the project that I forget to read this..
    I'll try this later today....



    BTW if you have time maybe you could check out my other post...
    http://www.microchip.com/forums/tm.aspx?m=483313



    Thanks a lot,
    tulclint
    #6
    tulclint
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2010/02/23 01:22:13
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2010/03/08 23:28:57 (permalink)
    0
    Hi Tsuneo,

    I tried what you said above but I'm having a different result. When I send a x=y=0x7E the mouse pointer is near the upper left side instead of somewhere near the middle.
    Below is the descriptor.




    //Class specific descriptor - HID mouse
    ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
    {0x05, 0x01, /* Usage Page (Generic Desktop) */
    0x09, 0x02, /* Usage (Mouse) */
    0xA1, 0x01, /* Collection (Application) */
    0x09, 0x01, /* Usage (Pointer) */
    0xA1, 0x00, /* Collection (Physical) */
    0x05, 0x09, /* Usage Page (Buttons) */
    0x19, 0x01, /* Usage Minimum (01) */
    0x29, 0x03, /* Usage Maximum (03) */
    0x15, 0x00, /* Logical Minimum (0) */
    0x25, 0x01, /* Logical Maximum (0) */
    0x95, 0x03, /* Report Count (3) */
    0x75, 0x01, /* Report Size (1) */
    0x81, 0x02, /* Input (Data, Variable, Absolute) */
    0x95, 0x01, /* Report Count (1) */
    0x75, 0x05, /* Report Size (5) */
    0x81, 0x01, /* Input (Constant) ;5 bit padding */
    0x05, 0x01, /* Usage Page (Generic Desktop) */
    0x09, 0x31, /* Usage (Y) */
    0x09, 0x30, /* Usage (X) */
    // 0x35, 0x00, /* Physical minimum = 0 */
    // 0x46, 0xFF,0x04, /*Physical minimum = 1279*/
    0x15, 0x00, /* Logical Minimum = 0 */
    0x26, 0xFF,0x03, /* logical Maximum = 1023 */
    0x35,0x00, /* Physical minimum 0 */
    0x45, 0x0A, /*physical maximum 10 */
    0x65,0x13, /* Unit Eng Lin:Distance */

    0x75, 0x10, /* Report Size (16) */
    0x95, 0x02, /* Report Count (1) */
    0x81, 0x02, /* Input (Data, Variable, Relative) 0x06 orig 02-absolute */

    // 0x09, 0x31, /* Usage (Y) */
    // 0x35, 0x00, /* Physical minimum = 0 */
    //0x46, 0xFF,0x03, /*Physical minimum = 1024*/
    //0x15, 0x00, /* Logical Minimum = 0 */
    //0x26, 0xFF,0x03, /* logical Maximum = 1024 */
    //0x75, 0x10, /* Report Size (16) */
    //0x95, 0x01, /* Report Count (1) */

    //0x81, 0x02, /* Input (Data, Variable, Relative) 0x06 orig 02-absolute */
    0xC0, 0xC0}
    };/* End Collection,End Collection */



    thanks,
    Clint
    #7
    karhik_hr
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Status: offline
    Re: RE: MOUSE HID / Resolution problem 2011/03/11 03:38:16 (permalink)
    0
    hey,
          I have started to do a HID mouse using 18f4550, I need suggestions on what to use for a the mouse, I mean joystick or a touchpad? I didnt find any touchpad or optical sensor which is locally available. The only thing that is localloy available is a joystick which has two potentiometers. I am using 18f4550 as I want to implement a keyboard along with it. I mean a HID composite device which is wireless(IR).
    #8
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2011/04/20 02:44:10 (permalink)
    0
    tulclint
    ...When I send a x=y=0x7E the mouse pointer is near the upper left side instead of somewhere near the middle...

     
    //Class specific descriptor - HID mouse
    ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
    {0x05, 0x01, /* Usage Page (Generic Desktop) */
    0x09, 0x02, /* Usage (Mouse) */
    0xA1, 0x01, /* Collection (Application) */
    0x09, 0x01, /* Usage (Pointer) */
    0xA1, 0x00, /* Collection (Physical) */
    0x05, 0x09, /* Usage Page (Buttons) */
    0x19, 0x01, /* Usage Minimum (01) */
    0x29, 0x03, /* Usage Maximum (03) */
    0x15, 0x00, /* Logical Minimum (0) */
    0x25, 0x01, /* Logical Maximum (0) */                        <------- what if you modify this value?
    0x95, 0x03, /* Report Count (3) */
    0x75, 0x01, /* Report Size (1) */
    0x81, 0x02, /* Input (Data, Variable, Absolute) */
    0x95, 0x01, /* Report Count (1) */
    0x75, 0x05, /* Report Size (5) */
    0x81, 0x01, /* Input (Constant) ;5 bit padding */
    ...


    thanks,
    Clint


    Just an idea...
    Hartwig
    #9
    mywaypeng
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2011/08/12 23:33:42
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2011/08/13 01:11:25 (permalink)
    0
    Dear tulclint
    I'm jack and meet the problem as you did before.
    I follow your forum and now HID frimware can send 16bit X,Y data to PC.
    but it does work fine in desktop that the cousor go here and there....
     
    should I change the driver for the absolute mouse device?
     
    my email address is mywaypeng@126.com
     
    look forward to your reply and thank you.
     
    Best regards, Jack
     
     
     
     
    tulclint

    Finally got it....
    Added Physical limits....
    Set both Physical and Logical minimum, maximum to 0 and 1024 respectively. Resolution is almost perfect for my screen.

     
    0x09, 0x30, /* Usage (X) */
    0x09, 0x31, /* Usage (Y) */
    0x35, 0x00, /* Physical minimum = 0 */
    0x46, 0xFF,0x03, /*Physical minimum = 1023*/
    0x15, 0x00, /* Logical Minimum = 0 */
    0x26, 0xFF,0x03, /* logical Maximum = 1023 */
    0x75, 0x10, /* Report Size (16) */
    0x95, 0x02, /* Report Count (2) */
    0x81, 0x02, /* Input (Data, Variable, Relative) 0x06 orig 02-absolute */
    0xC0, 0xC0}



    thanks,
    tulclint


    #10
    raedon
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2012/07/22 11:48:59
    • Location: 0
    • Status: offline
    RE: MOUSE HID / Resolution problem 2012/07/27 14:03:53 (permalink)
    0
    tulclint, do u have a full working simple project for ur absolute keyboard? i cant make it work, y just change the descriptor like u said but it ididnt work, the cursor dosent move.
     
    Thanks.
    #11
    const50
    Starting Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2012/10/20 07:44:10
    • Location: Tomsk Siberia
    • Status: offline
    RE: MOUSE HID / Resolution problem 2013/05/01 06:57:37 (permalink)
    0
    But how to adjust the absolute coordinate mouse with the screen pixels size?
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5