Cannot get gamepad input working. joystick.py example

195 views
Skip to first unread message

Christopher Lee Fanning

unread,
Apr 16, 2017, 3:58:49 PM4/16/17
to kivy-...@googlegroups.com
Hello, 

I can't get joystick.py to work.

System is running Fedora 24.  Using a PS4 gamepad over BlueTooth. The gamepad works with the other pygame projects, but I'm trying to get it to work with Kivy.  I get a blank window and no buttons produce any response, 

Thanks in advance,
Chris

Terminal output:

$python joystick.py
[INFO   ] [Logger      ] Record log in /home/chris/.kivy/logs/kivy_17-04-16_12.txt
[INFO   ] [Kivy        ] v1.9.1
[INFO   ] [Python      ] v2.7.13 (default, Jan 12 2017, 17:59:37)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
[INFO   ] [Factory     ] 179 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[WARNING] [WinPygame   ] Video: failed (multisamples=2)
[WARNING] [WinPygame   ] trying without antialiasing
[INFO   ] [GL          ] OpenGL version <3.0 Mesa 13.0.4>
[INFO   ] [GL          ] OpenGL vendor <Intel Open Source Technology Center>
[INFO   ] [GL          ] OpenGL renderer <Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) >
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <1.30>
[INFO   ] [GL          ] Texture max size <8192>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event5
[INFO   ] [MTD         ] Read event from </dev/input/event5>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event14
[INFO   ] [MTD         ] Read event from </dev/input/event14>
[INFO   ] [Base        ] Start application main loop
 
Exception in thread Thread-1:
 
Traceback (most recent call last):
   
File "/usr/lib64/python2.7/threading.py", line 804, in __bootstrap_inner
     
self.run()
   
File "/usr/lib64/python2.7/threading.py", line 757, in run
     
self.__target(*self.__args, **self.__kwargs)
   
File "/usr/lib64/python2.7/site-packages/kivy/input/providers/mtdev.py", line 219, in _thread_run
     _device
= Device(_fn)
   
File "/usr/lib64/python2.7/site-packages/kivy/lib/mtdev.py", line 131, in __init__
     
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
 
OSError: [Errno 13] Permission denied: '/dev/input/event5'
 
 
Exception in thread Thread-2:
 
Traceback (most recent call last):
   
File "/usr/lib64/python2.7/threading.py", line 804, in __bootstrap_inner
     
self.run()
   
File "/usr/lib64/python2.7/threading.py", line 757, in run
     
self.__target(*self.__args, **self.__kwargs)
   
File "/usr/lib64/python2.7/site-packages/kivy/input/providers/mtdev.py", line 219, in _thread_run
     _device
= Device(_fn)
   
File "/usr/lib64/python2.7/site-packages/kivy/lib/mtdev.py", line 131, in __init__
     
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
 
OSError: [Errno 13] Permission denied: '/dev/input/event14'
 
[INFO   ] [Base        ] Leaving application in progress...





Geekademy

unread,
Apr 18, 2017, 9:22:21 PM4/18/17
to kivy-...@googlegroups.com
These kind of errors mean that you need to put yourself into the "input" group.

Christopher Lee Fanning

unread,
Apr 19, 2017, 6:05:28 PM4/19/17
to kivy-...@googlegroups.com
Hey,

Thanks for your reply.  I've added the user to the input group, and the errors are gone, but the gamepad's buttons are not being picked up by the app.

It looks like the kivy example is using the wrong device.

Here is a snippet from dmesg and the new output.


[  120.345313] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  120.345321] Bluetooth: HIDP socket layer initialized
[  120.440357] sony 0005:054C:05C4.0005: Using modified Dualshock 4 Bluetooth report descriptor
[  120.445693] input: Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/bluetooth/hci0/hci0:256/0005:054C:05C4.0005/input/input16
[  120.446193] input: Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/bluetooth/hci0/hci0:256/0005:054C:05C4.0005/input/input15
[  120.446393] sony 0005:054C:05C4.0005: input,hidraw2: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 78:0c:b8:47:c7:13
[ 1788.118839] sony 0005:054C:05C4.0006: Using modified Dualshock 4 Bluetooth report descriptor
[ 1788.127000] input: Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/bluetooth/hci0/hci0:256/0005:054C:05C4.0006/input/input18
[ 1788.127900] input: Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/bluetooth/hci0/hci0:256/0005:054C:05C4.0006/input/input17
[ 1788.128523] sony 0005:054C:05C4.0006: input,hidraw2: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 78:0c:b8:47:c7:13
[ 1869.779340] perf: interrupt took too long (2525 > 2500), lowering kernel.perf_event_max_sample_rate to 79000
[ 2607.301122] perf: interrupt took too long (3173 > 3156), lowering kernel.perf_event_max_sample_rate to 63000
[ 3887.964071] perf: interrupt took too long (3973 > 3966), lowering kernel.perf_event_max_sample_rate to 50000
[chris@localhost miscellaneous] $ python
python                    python3                   python3
.5m-x86_64-config  python3-pyinotify
python2                   python3
.5                 python3-chardetect        python-config
python2
.7                 python3.5-config          python3-config            python-html2text
python2
.7-config          python3.5m                python3-coverage          
python2
-config            python3.5m-config         python3-mako-render      
[chris@localhost miscellaneous] $ python joystick.py
[INFO   ] [Logger      ] Record log in /home/chris/.kivy/logs/kivy_17-04-19_8.txt
[INFO   ] [Kivy        ] v1.9.1
[INFO   ] [Python      ] v2.7.13 (default, Jan 12 2017, 17:59:37)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
[INFO   ] [Factory     ] 179 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[WARNING] [WinPygame   ] Video: failed (multisamples=2)
[WARNING] [WinPygame   ] trying without antialiasing
[INFO   ] [GL          ] OpenGL version <3.0 Mesa 13.0.4>
[INFO   ] [GL          ] OpenGL vendor <Intel Open Source Technology Center>
[INFO   ] [GL          ] OpenGL renderer <Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) >
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <1.30>
[INFO   ] [GL          ] Texture max size <8192>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event5
[INFO   ] [MTD         ] Read event from </dev/input/event5>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event14
[INFO   ] [MTD         ] Read event from </dev/input/event14>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [MTD         ] </dev/input/event5> range position X is 0 - 4095
[INFO   ] [MTD         ] </dev/input/event5> range position Y is 0 - 2047
[INFO   ] [MTD         ] </dev/input/event14> range position X is 0 - 1920
[INFO   ] [MTD         ] </dev/input/event5> range touch major is 0 - 0
[INFO   ] [MTD         ] </dev/input/event14> range position Y is 0 - 942
[INFO   ] [MTD         ] </dev/input/event5> range touch minor is 0 - 0
[INFO   ] [MTD         ] </dev/input/event14> range touch major is 0 - 0
[INFO   ] [MTD         ] </dev/input/event5> range pressure is 0 - 255
[INFO   ] [MTD         ] </dev/input/event14> range touch minor is 0 - 0
[INFO   ] [MTD         ] </dev/input/event5> axes invertion: X is 0, Y is 0
[INFO   ] [MTD         ] </dev/input/event14> range pressure is 0 - 255
[INFO   ] [MTD         ] </dev/input/event5> rotation set to 0
[INFO   ] [MTD         ] </dev/input/event14> axes invertion: X is 0, Y is 0
[INFO   ] [MTD         ] </dev/input/event14> rotation set to 0

[INFO   ] [Base        ] Leaving application in progress...
[chris@localhost miscellaneous] $
[chris@localhost miscellaneous] $
[chris@localhost miscellaneous] $ groups
chris wheel dialout
lock input
[chris@localhost miscellaneous] $




Thanks again
Chris
Reply all
Reply to author
Forward
0 new messages