xpl_happy_pedals
Toto je starší verze dokumentu!
Happy pedals XPL issue
- X-Plane od 10.10 nepoužívá linuxové rozhraní /dev/input/jsX.
- protože js rozhraní omezuje: podléhá kalibraci, zavádí například null zóny atd…
- Místo toho /dev/input/eventX
- vyžaduje oprávnění na eventX
- stačí chmod o+r
- machři to dělají přes udev rule
- eventX lze identifikovat podle id nebo path, podle id takto:
Pharaon:/dev/input/by-id# ls -la /dev/input/by-id/ celkem 0 drwxr-xr-x 2 root root 240 zář 3 21:04 . drw-rw-r-x 4 root root 320 zář 3 20:49 .. lrwxrwxrwx 1 root root 9 zář 3 20:49 usb-Arduino_LLC_Arduino_Leonardo-event-if02 -> ../event7 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_Gaming_Mouse_G300-event-mouse -> ../event2 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_Gaming_Mouse_G300-if01-event-kbd -> ../event3 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_Gaming_Mouse_G300-mouse -> ../mouse0 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_Logitech_Extreme_3D-event-joystick -> ../event6 lrwxrwxrwx 1 root root 6 zář 3 19:47 usb-Logitech_Logitech_Extreme_3D-joystick -> ../js0 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_USB_Keyboard-event-if01 -> ../event5 lrwxrwxrwx 1 root root 9 zář 3 19:47 usb-Logitech_USB_Keyboard-event-kbd -> ../event4
lsinput
/dev/input/event6 bustype : BUS_USB vendor : 0x46d product : 0xc215 version : 272 name : "Logitech Logitech Extreme 3D" phys : "usb-0000:00:14.0-4/input0" uniq : "" bits ev : EV_SYN EV_KEY EV_ABS EV_MSC /dev/input/event7 bustype : BUS_USB vendor : 0x2341 product : 0x8036 version : 257 name : "Arduino LLC Arduino Leonardo" phys : "usb-0000:00:1a.0-1.4/input2" uniq : "" bits ev : EV_SYN EV_KEY EV_ABS EV_M
evtest
- eventX lze číst přes evtest nástroj
- příklad logitech:
Pharaon:/dev/input/by-id# evtest /dev/input/event6
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x46d product 0xc215 version 0x110
Input device name: "Logitech Logitech Extreme 3D"
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 508
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 1 (ABS_Y)
Value 516
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 5 (ABS_RZ)
Value 128
Min 0
Max 255
Flat 15
Event code 6 (ABS_THROTTLE)
Value 213
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)
Properties:
Testing ... (interrupt to exit)
- happy pedals
Pharaon:/dev/input/by-id# evtest /dev/input/event7
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x2341 product 0x8036 version 0x101
Input device name: "Arduino LLC Arduino Leonardo"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 288 (BTN_TRIGGER)
Event code 289 (BTN_THUMB)
Event type 3 (EV_ABS)
Event code 2 (ABS_Z)
Value 480
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 3 (ABS_RX)
Value 20
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 4 (ABS_RY)
Value 23
Min 0
Max 1023
Fuzz 3
Flat 63
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
lsusb
Bus 001 Device 003: ID 046d:c215 Logitech, Inc. Extreme 3D Pro
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x046d Logitech, Inc.
idProduct 0xc215 Extreme 3D Pro
bcdDevice 2.04
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 30mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 33 US
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 122
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0007 1x 7 bytes
bInterval 10
Bus 005 Device 011: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x2341 Arduino SA
idProduct 0x8036 Leonardo (CDC ACM, HID)
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 100
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0 None
iInterface 0
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x01
call management
bDataInterface 1
CDC ACM:
bmCapabilities 0x06
sends break
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 64
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 52
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 1
zkoumání xpl
- jak X-Plane zjístí seznam events?
- on ví, že jich je max 32, tak to prostě zkusí
strace /opt/X-Plane\ 10/X-Plane-x86_64 2>&1 | grep -i "/dev/input"
open("/dev/input/event0", O_RDONLY) = 20
open("/dev/input/event1", O_RDONLY) = 20
open("/dev/input/event2", O_RDONLY) = 20
open("/dev/input/event3", O_RDONLY) = 20
open("/dev/input/event4", O_RDONLY) = 20
open("/dev/input/event5", O_RDONLY) = 20
open("/dev/input/event6", O_RDONLY) = 20
open("/dev/input/event7", O_RDONLY) = 28
open("/dev/input/event8", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event9", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event10", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event11", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event12", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event13", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event14", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event15", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event16", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event17", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event18", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event19", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event20", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event21", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event22", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event23", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event24", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event25", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event26", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event27", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event28", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event29", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event30", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/input/event31", O_RDONLY) = -1 ENOENT (No such file or directory)
- oprávnění určitě měl!!
- dostal file deskriptor number
- a testoval jsem to i přes grep -i permission
- a navíc jsem to omylem spustil pod rootem :)
- a takhle X-Plane pozná, zda je tam nový device
inotify_add_watch(7, "/dev/input", IN_ATTRIB|IN_CREATE|IN_DELETE) = 2
- podle čeho se rozhodne, že se mu eventX líbí?
open("/dev/input/event0", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event1", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event2", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event3", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event4", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event5", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/input/event6", O_RDONLY) = 30
ioctl(30, EVIOCGBIT(EV_SYN, 8), [SYN_REPORT, SYN_CONFIG, SYN_DROPPED, 0x4 /* SYN_??? */]) = 8
ioctl(30, EVIOCGBIT(EV_KEY, 96), [ 0 ]) = 96
ioctl(30, EVIOCGBIT(EV_ABS, 8), [ABS_X, ABS_Y, ABS_RZ, ABS_THROTTLE]) = 8
fcntl(30, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
ioctl(30, EVIOCGNAME(256), "Logitech Logitech Extreme 3D") = 29
ioctl(30, EVIOCGUNIQ(256), "") = 1
ioctl(30, EVIOCGID, {ID_BUS=3, ID_VENDOR=1133, ...}) = 0
ioctl(30, EVIOCGBIT(EV_KEY, 96), [ 0 ]) = 96
ioctl(30, EVIOCGBIT(EV_ABS, 8), [ABS_X, ABS_Y, ABS_RZ, ABS_THROTTLE]) = 8
ioctl(30, EVIOCGABS(ABS_X), {value=508, minimum=0, ...}) = 0
ioctl(30, EVIOCGABS(ABS_Y), {value=516, minimum=0, ...}) = 0
ioctl(30, EVIOCGABS(ABS_RZ), {value=128, minimum=0, ...}) = 0
ioctl(30, EVIOCGABS(ABS_THROTTLE), {value=213, minimum=0, ...}) = 0
open("/dev/input/event7", O_RDONLY) = 31
ioctl(31, EVIOCGBIT(EV_SYN, 8), [SYN_REPORT, SYN_CONFIG, SYN_DROPPED, 0x4 /* SYN_??? */]) = 8
ioctl(31, EVIOCGBIT(EV_KEY, 96), [ 0 ]) = 96
ioctl(31, EVIOCGBIT(EV_ABS, 8), [ABS_Z, ABS_RX, ABS_RY]) = 8
close(31)
connected threads
založení vlákna
xpl_happy_pedals.1441378053.txt.gz · Poslední úprava: (upraveno mimo DokuWiki)
