kobo-btpt icon indicating copy to clipboard operation
kobo-btpt copied to clipboard

LinYuvo KS54 Mini Bluetooth Gamepad Controller

Open el opened this issue 11 months ago • 3 comments

Hi, I recently picked up a LinYuvo KS54 Mini Bluetooth Gamepad Controller from AliExpress. Here are the codes for anyone that wants to use it.

File Name:

/.btpt/Xbox Wireless Controller

Direction buttons

prevPage EV_KEY BTN_NORTH 0
nextPage EV_KEY BTN_SOUTH 0
prevPage EV_KEY BTN_WEST 0
nextPage EV_KEY BTN_EAST 0

Action buttons

prevPage EV_KEY KEY_BACK 0
nextPage EV_KEY BTN_START 0
prevPage EV_KEY BTN_TL 0
nextPage EV_KEY BTN_TR 0

el avatar Jan 27 '25 13:01 el

Thank you for this. Incredibly helpful since I was going through this documentation and couldn't get anything to work. Is there any sort of documentation for this controller? How did you manage to find these buttons?

I tried adding different commands such as "sleepWake", "homeScreen", "backButton" or even "increaseBrightness" but looks like nothing working accordingly.

I also noticed these are the direction buttons but not the D-PAD. Any way to use the D-pad instead? Quite strange the XYAB buttons are named north south west and east lol.

it0na72 avatar Mar 01 '25 02:03 it0na72

@it0na72 I have a different generic bluetooth controller and was able to determine the events that were generated by pressing different buttons or moving the joystick. I can't speak to the specifics for your particular controller but this might be able to point you in the right direction.

First, I paired/connected the bluetooth device to my computer. It gets paired as a human interface device in the same way a keyboard or mouse would, so pushing buttons resulted in various actions on my computer (e.g. show desktop, open application menu, volume up/down, mute, etc.) At this point it's not immediately clear what button corresponds to which action.

Since I am running Linux, I used the evtest tool (mentioned in the README of this repo) to listen to event that was being sent each time a button on my controller was pressed. As an example, the command might produce the following output when I pressed a certain button:

Event: time 1734738910.851159, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0

Naturally, that button replicated a discrete key press--in this case, pressing the volume up key on my computer. If I wanted that button to turn to the previous page on my Kobo, i'd add the following line to the config file:

prevPage EV_KEY KEY_VOLUMEUP 0

Other actions like moving the joystick produced output like this:

Event: time 1734737702.366045, type 2 (EV_REL), code 1 (REL_Y), value -2

which suggests that the relative Y value of the cursor is being moved up or down by 2 (whatever that quantity represents). For cases like this with relative events like this, it wasn't always intuitive if negative values referred to up or down, so I had to play around with it and see what was output when I moved the joystick in different directions.

I can't speak to the specifics of your device or OS but if you're able to connect your controller to a computer and determine which HID events are being sent, you should be able to get the info you need to modify the config file accordingly. Also, I should note that this only gets you the actual button events--apart from Kobo actions referenced in this repo (e.g. prevPage, nextPage, etc.) it's not clear if any other behavior is possible at this point. Anyway, hope that helps!

lolroger avatar Mar 02 '25 23:03 lolroger

Thank you for this. Incredibly helpful since I was going through this documentation and couldn't get anything to work. Is there any sort of documentation for this controller? How did you manage to find these buttons?

I tried adding different commands such as "sleepWake", "homeScreen", "backButton" or even "increaseBrightness" but looks like nothing working accordingly.

I also noticed these are the direction buttons but not the D-PAD. Any way to use the D-pad instead? Quite strange the XYAB buttons are named north south west and east lol.

You can use the evtest tool with a Linux based device

The Linux Input Subsystem event codes that represent the input events you want to use to turn pages. You can find these using the evtest tool, for example.

el avatar Mar 05 '25 20:03 el