Harvie / ps2dev

Arduino library to emulate PS2 keyboard/mouse
MIT License
111 stars 26 forks source link

Is mouse wheel supported? #15

Open FreezingEye opened 3 years ago

FreezingEye commented 3 years ago

Is mouse wheel supported?

Harvie commented 3 years ago

I had only worked with keyboard. Mouse example was contributed by @liumazi some time ago. I am 100% sure that mouse wheel can be done, but i think it might need some extra coding.

Idealy it would be vital to modify ps2dev library to have mouse_init() and mouse_handle() methods similar to keyboard counterparts. Originaly ps2dev contained only low-level code which was annoying to use (raw sending and receiving bytes over ps2). So i've created the init/handle/mkbrk methods to make everything bit easier to use. But so far we don't have this kind of high level code for mouse.

Eg.: right now you can emulate mouse wheel using low level api of ps2dev library, but once you write the high-level code for mouse wheel on top of ps2dev it would make sense to integrate it directly to ps2dev, so it can be used by other people.

Also i wonder if it would be possible for single device to be used as both mouse and keyboard at the same time (using single ps2 port). That would affect the design decisions, because it would make sense to have single handle() method common for both mouse and keyboard.

FreezingEye commented 3 years ago

emm..I think liumazi is not activing in github this year.But his/her code is interesting.I try to check it out.

chuchana commented 2 years ago

i wonder if it would be possible for single device to be used as both mouse and keyboard at the same time (using single ps2 port).

It does seem possible, but it might not be widely supported:

Keyboard and mouse ports may be combined into a single port which can be used to connect both by splitter cable. [wikipedia: PS/2 port (note a)]

a given system's keyboard and mouse port may not be interchangeable since the two devices use different sets of commands and the device drivers generally are hard-coded to communicate with each device at the address of the port that is conventionally assigned to that device. [wikipedia: PS/2 port]

liumazi commented 2 years ago

emm..I think liumazi is not activing in github this year.But his/her code is interesting.I try to check it out.

The PS/2 Mouse Interface - https://blog.csdn.net/Augusdi/article/details/7288556

The host then issues the "Get device ID" command (0xF2) and waits for a response. If a standard PS/2 mouse (ie, non-Intellimouse) is attached, it will respond with a device ID of 0x00. In this case, the host will recognize the fact that the mouse does have a scrolling wheel and will continue to treat it as a standard PS/2 mouse. However, if a Microsoft Intellimouse is attached, it will respond with an ID of 0x03. This tells the host that the attached pointing device has a scrolling wheel and the host will then expect the mouse to use the following 4-byte movement data packet: ...