我将 IPD Ultima 游戏杆连接到我的 Linux 机器。当我执行以下操作时:
$ modprobe uinput $ lsmod | grep 输入
uinput 17246 0
$ lsusb - 好的
Bus 002 Device 002: ID 0461:4d65 Primax Electronics, Ltd
$ xinput list - 什么都没有
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
⎜ ↳ USB Optical Mouse id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]
$ dmesg - 好的
H PRODUCTS CH Products IPD Ultima] on usb-0000:00:1d.1-1/input0
[42731.000208] usb 3-1: USB disconnect, device number 2
[42737.291095] usb 3-1: new low-speed USB device number 3 using uhci_hcd
[42737.457157] usb 3-1: New USB device found, idVendor=068e, idProduct=0060
[42737.457167] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[42737.457175] usb 3-1: Product: CH Products IPD Ultima
[42737.457182] usb 3-1: Manufacturer: CH PRODUCTS
[42737.489359] input: CH PRODUCTS CH Products IPD Ultima as /devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/input/input13
[42737.489867] generic-usb 0003:068E:0060.0005: input,hidraw0: USB HID v1.00 Joystick [CH PRODUCTS CH Products IPD Ultima] on usb-0000:00:1d.1-1/input0
$ python it: - 不行
sf1 = open("test.usbdump").read() # read the earlier usb dump from hiddevice
kb = open("/dev/usb/hiddev0")
while 1:
print (kb.read(len(sf1)) == sf1)
$ pgame it: - 不行
#/usr/bin/env python
#
# yum list installed pygame*
#Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
#Installed Packages
#pygame.i686 1.9.1-6.fc15 @updates
#pygame-devel.i686 1.9.1-6.fc15 @updates
import os, pygame
from pygame.locals import *
def main():
pygame.init()
pygame.joystick.init()
pygame.display.set_mode((468, 60))
pygame.display.set_caption('HID Python')
pygame.mouse.set_visible(0)
while 1:
for event in pygame.event.get():
print event.type
if event.type == QUIT:
return
elif event.type == KEYDOWN and event.key == K_ESCAPE:
return
elif event.type == MOUSEBUTTONDOWN:
print '\/'
elif event.type is MOUSEBUTTONUP:
print '/\'
elif event.type is JOYAXISMOTION:
print '()'
elif event.type is JOYBALLMOTION:
print '()()'
elif event.type is JOYHATMOTION:
print '<>'
elif event.type is JOYBUTTONUP:
print '//\\'
elif event.type is JOYBUTTONDOWN:
print '\\//'
if __name__ == '__main__':
main()
没运气。任何帮助的想法为什么我什么都得不到?
跟进:
# cat /dev/input/js0
=c��=c��=c��=c��=c��=c��=c��=c��=c�=c�� =c��
=c��
=c��=c��=c��
&n��n�Vp�&q�r��r�Nt��t�>u��u��v�w�~w��z���{��|�}�n}��}�~�N~��~��~�.������������������������>�����拋6�����V�����������6�����&��������v��昋�v��