Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Apr 2022
    Posts
    10

    Using a USB Gamepad with Picoreplayer

    As per the title, could someone please give me some assistance in figuring out how i can use a gamepad with picore player please?
    I would like to hack the gamepad for its analogue joystick input functions.

    Many thanks

  2. #2
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    3,029
    See this post for details on downloading the evtest tool.

    Here's the output from a Logitech controller.

    Code:
    tc@rpi27:/mnt/mmcblk0p2/tce$ ./evtest
    No device specified, trying to scan all of /dev/input/event*
    Not running as root, no devices may be available.
    Available devices:
    /dev/input/event0:	FT5406 memory based driver
    /dev/input/event1:	Logitech Logitech Dual Action
    Select the device event number [0-1]: 1
    Input driver version is 1.0.1
    Input device ID: bus 0x3 vendor 0x46d product 0xc216 version 0x111
    Input device name: "Logitech Logitech Dual Action"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
        Event code 288 (BTN_TRIGGER)
        Event code 289 (BTN_THUMB)
        Event code 290 (BTN_THUMB2)
        Event code 291 (BTN_TOP)
        Event code 292 (BTN_TOP2)
        Event code 293 (BTN_PINKIE)
        Event code 294 (BTN_BASE)
        Event code 295 (BTN_BASE2)
        Event code 296 (BTN_BASE3)
        Event code 297 (BTN_BASE4)
        Event code 298 (BTN_BASE5)
        Event code 299 (BTN_BASE6)
      Event type 3 (EV_ABS)
        Event code 0 (ABS_X)
          Value    127
          Min        0
          Max      255
          Flat      15
        Event code 1 (ABS_Y)
          Value    127
          Min        0
          Max      255
          Flat      15
        Event code 2 (ABS_Z)
          Value    128
          Min        0
          Max      255
          Flat      15
        Event code 5 (ABS_RZ)
          Value    127
          Min        0
          Max      255
          Flat      15
        Event code 16 (ABS_HAT0X)
          Value      0
          Min       -1
          Max        1
        Event code 17 (ABS_HAT0Y)
          Value      0
          Min       -1
          Max        1
      Event type 4 (EV_MSC)
        Event code 4 (MSC_SCAN)
    You should be able to remap the EV_KEY event type 1 keys using the information from this post.

    Load the evdev kernel module
    Code:
    tc@rpi27:~$ sudo modprobe evdev
    Find the joystick device name
    Code:
    tc@rpi27:/mnt/mmcblk0p2/tce$ cat /proc/bus/input/devices
    
    I: Bus=0003 Vendor=046d Product=c216 Version=0111
    N: Name="Logitech Logitech Dual Action"
    P: Phys=usb-3f980000.usb-1.4/input0
    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:046D:C216.0001/input/input2
    U: Uniq=F7FA2D56
    H: Handlers=event1 js0 
    B: PROP=0
    B: EV=1b
    B: KEY=fff 0 0 0 0 0 0 0 0 0
    B: ABS=30027
    B: MSC=10
    Run inputlircd as the tc user in an ssh session.

    sudo /usr/local/sbin/inputlircd -n "Logitech Logitech Dual Action" -m 0 -g -r 500 -f

    And in another ssh connect run irw which returns.
    tc@rpi27:~$ irw
    Code:
    120 0 BTN_JOYSTICK /dev/input/event1
    121 0 BTN_THUMB /dev/input/event1
    123 0 BTN_TOP /dev/input/event1
    122 0 BTN_THUMB2 /dev/input/event1
    You can map the keys to jivelite action by creating a keymap file for inputlircd.

    For example:
    Code:
    $ cat /home/tc/inputlircd.keymap
    BTN_TOP = KEY_UP
    BTN_THUMB = KEY_DOWN
    BTN_JOYSTICK = KEY_LEFT
    BTN_THUMB2 = KEY_RIGHT
    Press ctrl-c in the inputlircd session and restart it using
    sudo /usr/local/sbin/inputlircd -n "Logitech Logitech Dual Action" -m 0 -g -r 500 -t /home/tc/inputlircd.keymap -f

    Press ctrl-c in the irw session and restart irw and you should get the remapped keys.

    Code:
    tc@rpi27:~$ irw
    121 0 KEY_DOWN /dev/input/event1
    123 0 KEY_UP /dev/input/event1
    122 0 KEY_RIGHT /dev/input/event1
    120 0 KEY_LEFT /dev/input/event1
    Last edited by ralphy; 2022-04-09 at 06:54.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 2-UE Radio
    Squeezebox client builds donations always appreciated.

  3. #3
    Junior Member
    Join Date
    Apr 2022
    Posts
    10
    Hi @ralphy Sorry for my delay in responding,thank you for your very comprehensive response.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •