working with controller and USB dial slider.

Started by
1 comment, last by ulao 9 years ago

I'm developing a usb device using a HID descriptor and I have a catch 22 here. I have a controller that has two shoulder pressure buttons. I need a range from 0-255 with 0 being the resting point. In the various software gaming apps when mapping buttons it listens for a movement. If the shoulder is at 0 to 128 nothing is detected but at anything > than 128 it is detected. Windows DX seems to see shoulder at reset as 255 and fully pressed as 0. So I figure well this is easy, I'll reverse the value in the device firmware val = 255-val; Doing this makes Windows DX see the shoulder at rest as 0 and fully pressed as 255. Great right? Now DX sees shoulder at 255 to 128 as nothing detected and anything < 128 as detected.

Hope that was not too confusing. So I then came up with the idea of making 128 the resting point. This passes the detection and in game the value is always 128. So that is no good.

I dont know if the problem is the usb descriptor or that most software is written poorly.

Here is my analog portion of the usb descriptor

//axis
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x09, 0x35, // USAGE (Rz)
0x09, 0x36, // USAGE slider
0x09, 0x37, // USAGE dial
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
0x35, 0x00, // Physical Minimum (0)
0x46, 0xFF, 0x00, // Physical Minimum (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x08, // REPORT_COUNT (8)
0x81, 0x02, // INPUT

All values are 0-255 If needed I can break the slider and dial out and give it another range but nothing seems to help any. Hiw does one handel a presure button if DX always looks for <> 128 to sense a change in movment?

Advertisement

Admittedly I have no idea about your setup, but given input values of 255 to 0, can you use in your program a value of 255 - inputValue? That is, invert the value in your program, not the device.

I.e., you say you're getting an input of 255 for rest position, and 0 for fully pressed. Then 255 - input goes from 0 at rest position, to 255 fully pressed. Is that the desired response?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.



Admittedly I have no idea about your setup, but given input values of 255 to 0, can you use in your program a value of 255 - inputValue? That is, invert the value in your program, not the device.

I.e., you say you're getting an input of 255 for rest position, and 0 for fully pressed. Then 255 - input goes from 0 at rest position, to 255 fully pressed. Is that the desired response?

But as I said "So I figure well this is easy, I'll reverse the value in the device firmware val = 255-val;" doing that astonishingly just tells DX to look at it in reverse as well. It’s like DX looks at the signal thru a window. Does not matter if the value goes 0 to 255 or 255 to 0. Just senses the change -/+ from therest point (what ever that is). Confusing, yes. I think it just comes down to coders using a bad paradigm.

This topic is closed to new replies.

Advertisement