вс, 6 нояб. 2022 г. в 02:39, Paul Cercueil <paul@xxxxxxxxxxxxxxx>: > > Hi Siarhei, > > Le lun. 31 oct. 2022 à 22:01:57 +0300, Siarhei Volkau > <lis8215@xxxxxxxxx> a écrit : > > For detachable or lock-able joysticks the ADC lanes might > > be biased to GND or AVDD when the joystick is detached/locked. > > > > One such kind of joystick is found in the Ritmix RZX-50 handheld. > > The joystick is non-detachable, although ADC lane biased to power > > supply when the "Hold" switch is activated. > > But the RZX-50 has no joystick... Well, actually there's two versions in the wild (google "RZX-50 pictures"): - with analog joystick and speakers on the back side - without the joystick and speakers on the front side I have only the first one at the moment, but I'm looking for another one. > Or is the d-pad actually wired to the ADC instead of GPIOs? The D-Pad is another kind of pain there - it's a part of the matrix-keypad but the pad's row line is shared with the LCD HSYNC signal. > > To avoid reporting old/broken measurements valid-range is introduced. > > When measured value is outside valid-range the driver reports > > safe center position for corresponding axis. > > First of all, you already have a "valid range", it is called > "abs-range"; no need for a new one. > > Then, the driver has no business doing events filtering. Notice that > when you activate the "hold" button and your joystick values go way > off-range, you still get input events in userspace: that's because the > kernel is not responsible for enforcing the deadzone, the userspace is. > > In your case, you need to update your userspace applications/libraries > so that when the joystick values are way off-range, the assumed > position is the center. Many userspace apps use SDL library to handle joystick input, the SDL unfortunately hides the fact that the joystick position is out of range - it does normalization and clamping of the abs-range to an int16_t range. I see two approaches to do that in userspace: 1. Make a quirk in the SDL library, which affects many types of joysticks and lead to a fragmentation (special userspace apps for every hardware isn't the right way in my opinion). 2. Make a special filter app which will filter out invalid joystick events and route rest to the /dev/input/uinput. Not sure how to hide the real joystick device from libraries like SDL then. Both of them don't look like a "silver bullet", however feasible. > > Cheers, > -Paul > > Thank you.