Mouse is different on USB vs. PS/2

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Mouse is different on USB vs. PS/2

Post by Deniil »

I have my mouse connected to PS/2 because it is simply more stable (smaller driver, less likely to be overwritten by buggy apps).

Anyway: The point is that I have configured AllKeys to change the Mixer volume when I press the middle mouse button (the wheel that is) and scroll the wheel at the same time. To make this work the mouse has to be able to send wheel events with mouse buttons as qualifiers.

When connecting a mouse to USB this is impossible because the USB hid driver(or something) doesn't seem to send any mouse buttons as qualifiers for the wheel making it impossible to use the wheel as volume control :-(

Can you please fix this so the USB hid driver can send wheel events with qualifiers just as with PS/2?
You can use Allkeys (http://onyxsoft.se/allkeys.html) to test this out. It will list the raw codes and qualifiers which immediately makes it very obvious what happens.
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Mouse is different on USB vs. PS/2

Post by tonyw »

Can you provide the config file that you use with that commodity? Something that shows the qualifiers you are talking about?
cheers
tony
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Re: Mouse is different on USB vs. PS/2

Post by Deniil »

Sure, when I get home.
But it is the normal input.device middle-mouse button qualifier (can't remember the name of the constant now) that is delivered with the mouse wheel event if you press the wheel and scroll it at the same time. But this MMB (or LMB or RMB) qualifier only appears to be appended to the wheel event if the mouse is connected to PS/2, not USB.

I have not tried to hold down for example Shift and scroll the wheel on USB. Maybe that doesn't work either? I mean, maybe no qualifier at all is appended to any wheel event in USB mode..?! I haven't tested. On PS/2 any qualifier can be appended to a mouse wheel event.
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Re: Mouse is different on USB vs. PS/2

Post by Deniil »

I kind of forgot about this thread since I'm typically always on PS/2 (although I guess that will change with the X1000!!).

I don't see a point in supplying a config file, but I did some tests and these are the results:

PS/2 wheel up:
ie_Qualifier: 0x8000 (IEQUALIFIER_RELATIVEMOUSE), ie_Y: 0xFFFF (vertical -1)
PS/2 MMB + wheel up:
ie_Qualifier: 0x9000 (IEQUALIFIER_RELATIVEMOUSE + IEQUALIFIER_MIDBUTTON), ie_Y: 0xFFFF (vertical -1)
PS/2 Shift + wheel up:
ie_Qualifier: 0x8001 (IEQUALIFIER_RELATIVEMOUSE + IEQUALIFIER_LSHIFT), ie_Y: 0xFFFF (vertical -1)

USB wheel up:
ie_Qualifier: 0x0000 (), ie_Y: 0xFFFF (vertical -1)
USB MMB + wheel up:
ie_Qualifier: 0x0000 (), ie_Y: 0xFFFF (vertical -1)
USB Shift + wheel up:
ie_Qualifier: 0x0001 (IEQUALIFIER_LSHIFT), ie_Y: 0xFFFF (vertical -1)

ie_Class is always 0x17 (IECLASS_MOUSEWHEEL).
(Note that AllKeys internally codes ie_X/Y into the code field and concatenates it to the qualifiers.)

As you can see from this, the USB driver (or whatever) never provides any mouse qualifiers, neither RELATIVEMOUSE nor any XYZBUTTON qualifiers for the USB mouse wheel whether an additional button is pressed or not, only for PS/2.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Mouse is different on USB vs. PS/2

Post by xenic »

@Denill
You may not see any point in supplying a config file (or config description) but I do. I just tried AllKeys with the default configuration and don't see any output like you have posted; problem unconfirmed for me.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Re: Mouse is different on USB vs. PS/2

Post by Deniil »

@xenic

Then you are missing the point of how AllKeys work. You don't need a config to see this.
(The default configuration is empty. As if AllKeys was not running at all (unless I've made som blunder in the archive), and that is fine.)

To see the input stream you need to click the Add button. This will open a window where you can see the input stream live. You also need to unselect the "Ignore mouse events" checkmark to make sure you also see mouse clicks and stuff.

Now you are ready to actually see the bug. Press the middle mouse button (which is the wheel), then scroll the wheel at the same time. The list should spew out a code looking something like $9000ff00 where the crusial part is the 9000 which is the qualifier field. The text should display MMB + Wheel Up/Down.

But with my USB mouse the qualifier is 0000 which means that not even the RELATIVEMOUSE qualifier (0x8000) is set. The text reflects this by printing only Wheel Up/Down, not "MMB + .." or "LMB + ..." or whatever mousebutton you are pressing.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Mouse is different on USB vs. PS/2

Post by xenic »

@Denill
You also need to unselect the "Ignore mouse events" checkmark to make sure you also see mouse clicks and stuff.
I suppose my interpretation of config was wrong since AllKeys doesn't appear to save the state of the options in the learning window. When I unselect "ignore mouse events" and select "raw" I can see what you are referring to. However, since my SAM has no PS/2 input I can't observe the difference but will take your word for it. It looks like there is a midbutton qualifyer if you click the left or right buttons while holding the middle button but not for scrollwheel events. There is even a midbutton qualifier for keyboard presses is the scrollwheel is pressed. It looks to me like you're right; there should be a midbutton qualifier for scroll events.

As a side note, it looks like all the possible qualifier bits (UWORD) have been used up so we'd better hope they don't figure out a way to add yet another button to a mouse :-)
AmigaOne X1000 with 2GB memory - OS4.1 FE
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Re: Mouse is different on USB vs. PS/2

Post by Deniil »

Glad you figured it out, and could confirm the bug (so it's not my mouse that is wierd I mean) :-)

Well, they did add additional mouse buttons, but they cannot be qualifiers. I have 8 buttons on my mouse, but two double as scroll up/down and one is not recognized. I assume they need special driver configurations on windows or Mac to be used for anything else. But the 4th and 5th side-buttons are recognized on both my PS/2(with USB->PS/2 converter) and my new pure USB mouse so that is good. I use those for window-to-back and cycle screens.
Deniil
Posts: 111
Joined: Mon Jul 11, 2011 7:59 pm

Re: Mouse is different on USB vs. PS/2

Post by Deniil »

Just wanted to say that my new version of AllKeys fixes the qualifier problem with the USB mouse wheel and actually also all USB(subclass2 and 3) EXTENDEDRAWKEYs which also didn't receive any qualifiers.

Now I can press the MMB and scroll the wheel to change Mixer volume again, and make the play button behave differently depending on if I hold Shift or not :-)
Post Reply