OpenWRT에서 PS 게임 컨트롤러를 사용하는 방법은 무엇입니까?

OpenWRT에서 PS 게임 컨트롤러를 사용하는 방법은 무엇입니까?

저는 OpenWRT와 Linux 전반에 대해 처음 접했습니다. 그러니 저에게 이야기해 주세요.

OpenWRT를 사용하여 콘솔 게임패드의 버튼을 Arduino Yun의 콘솔로 인쇄하려고 합니다. opkg다음과 같은 패키지를 설치했습니다 .

kmod-input-core - 3.8.3-1
kmod-input-joydev - 3.8.3-1

다음을 사용하면 lsusb컨트롤러를 볼 수 있습니다 .

root@Arduino:~# lsusb -D /dev/bus/usb/001/004
Device: ID 054c:05c4 Sony Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x054c Sony Corp.
  idProduct          0x05c4
  bcdDevice            1.00
  iManufacturer           1 Sony Computer Entertainment
  iProduct                2 Wireless Controller
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     483
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0000
  (Bus Powered)

빠른 검색을 했는데 Linux에서 게임패드에 액세스하는 것과 관련된 대부분의 결과에서 /dev/input/js0예를 들어 액세스를 언급했습니다. 항상 거기에 있는 게임패드만 있고 /dev/input/event0아래에 Sony 게임패드가 표시되어 잘 모르겠습니다. /dev/usb/001/004먼저 제대로 초기화되었는지 . 모든 팁/요령이 도움이 될 것입니다.

또 다른 문제는 누른 키에 액세스하여 콘솔에 인쇄하는 것입니다. Yun에서는 디스크 공간이 제한되어 있고 아직 SD 카드를 설정하지 않았으므로 아직 gcc/g++가 없습니다. 지금 당장 가장 빠른 선택은 Python이나 쉘 스크립트를 사용하는 것이라고 생각합니다.

작은 스크립트로 시작했어요이 게시물:

#!/usr/bin/env python
import sys


pipe = open('/dev/bus/usb/001/004','r')
#pipe = open('/dev/input/event0','r')
byte = []

while 1:
        for bit in pipe.read(1):
                byte.append('%5X' % ord(bit))
                if len(byte) == 8:
                        print byte
                        byte = []

출력은 다음과 같습니다.

['   12', '    1', '    2', '    0', '    0', '    0', '    0', '   40']
['    5', '   4C', '    5', '   C4', '    1', '    0', '    1', '    2']
['    0', '    1', '    9', '    2', '   29', '    0', '    1', '    1']
['    0', '   C0', '   FA', '    9', '    4', '    0', '    0', '    2']
['    3', '    0', '    0', '    0', '    9', '   21', '   11', '    1']
['    0', '    1', '   22', '   E3', '    1', '    7', '    5', '   84']
['    3', '   40', '    0', '    5', '    7', '    5', '    3', '    3']

이것은 결코 변하지 않을 것입니다.

또한 pygame을 사용하는 많은 예제를 보았지만 pygame을 성공적으로 설치하지 못했고( 를 사용하여 opkg install python-pygame) SD를 설정할 때까지 소스에서 gcc/g++를 컴파일할 공간이 없습니다.

간단히 말해서: 게임패드가 올바르게 설치되었는지 확인하는 방법은 무엇입니까? 그렇지 않은 경우 openwrt에 USB 게임패드를 설치하는 올바른 방법은 무엇입니까? 게임 패드 키 입력을 콘솔에 인쇄하는 가장 간단하고 쉬운 방법은 무엇입니까?

관련 정보