Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a bluetooth mouse and since some time I'm experiencing an annoying issue.
When scrolling down (with the wheel) it sends some scroll up signals. I mean, scroll up is 4 and scroll down is 5. When scrolling down multiple times, what I get is something like 5 5 5 5 5 4 4 5 5 5 5 4 5 5 5... And, of course, the opposite when scrolling up. Something like 4 4 4 4 4 5 4 4 4...
It only happens when I scroll quickly, but in the everyday is really annoying, because the screen will do just the opposite to what you want.
OK, so I could just buy a new mouse, but I want to try to correct it programatically.
The easiest solution is to just disable one of the directions, and just use the wheel to scrool down (or up). I have already done that and the results aren't very pleasant.
The best solution, of course, would be to monitor the mouse input and check, through some algorithm if the signal is probably wrong. For example, if I have lots of 5 in a short period of time, and then a 4, so, probably this is another 5. How could I do that?
An easier solution could be always use the wheel in just one direction, and associate the opposite direction with the press of a button. For example, regardless of the direction I move the wheel, it will scroll down. However, if I move the wheel pressing the right button at the same time, it will scroll up.
So, how could I accomplish that? Or you have other good ideas to bypass that issue?
When scrolling down (with the wheel) it sends some scroll up signals. I mean, scroll up is 4 and scroll down is 5. When scrolling down multiple times, what I get is something like 5 5 5 5 5 4 4 5 5 5 5 4 5 5 5... And, of course, the opposite when scrolling up. Something like 4 4 4 4 4 5 4 4 4...
yes, I see. Easily happens with rotation detection, when the rotary speed exceeds the detection speed of the system.
Quote:
Originally Posted by milljunky
The easiest solution is to just disable one of the directions, and just use the wheel to scrool down (or up). I have already done that and the results aren't very pleasant.
I wouldn't call that a solution.
Quote:
Originally Posted by milljunky
The best solution, of course, would be to monitor the mouse input and check, through some algorithm if the signal is probably wrong. For example, if I have lots of 5 in a short period of time, and then a 4, so, probably this is another 5. How could I do that?
Exactly as you said: Whenever there's a "scroll up" or "scroll down" event, store it with a timestamp. When there's a scroll event with the opposite direction than the last one before, discard it if less than a minimum amount of time has elapsed. Otherwise, pass it along to the application. The time threshold (probably a few tenths of a second) could be a configurable parameter.
Quote:
Originally Posted by milljunky
An easier solution could be always use the wheel in just one direction, and associate the opposite direction with the press of a button. For example, regardless of the direction I move the wheel, it will scroll down. However, if I move the wheel pressing the right button at the same time, it will scroll up.
I guess I have to intercept the mouse signals before X and then pass to it the correct ones.
I'm just clueless in the implementation.
well, so am I, sorry. But you seemed so well-informed about the signaling from your mouse that I thought you had already tapped the command flow for examination, and it looked like all you needed was a proper algorithm.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.