A Antonio Ospite #
Message details and related content
Hi, in my attempts to handle leds setting and usb pairing for the Sixaxis controller I had to fight with libudev a little bit, eventually I succeeded in what I wanted to achieve but I still have some questions about the libudev API, so here I am. This is basically the layout for the device: 4-1:1.0/ |-- 0003:054C:0268.000C (hid device) | |-- hidraw | | `-- hidraw1 | `-- uevent (which tells me HID_PHYS) | `-- input `-- input17 |-- js0 `-- phys I needed to get the hidraw device node, and the js device number, the two sibling devices (from hid and input subsystem) can be matched using the 'phys' property. This is what I do now: 0. Monitor with a filter matching the "hidraw" subsystem. 1. When a matching device is connected we get the "hidraw" device. 2. Go up to its "hid" parent device and check it is actually a Sixaxis (using HID_NAME), if not GOTO 1. 3. Store the hidraw device node for later use 4. Store the HID_PHYS value in order to look for the matching joystick. 5. Enumerate the joystick devices with the sysname filter "js*" 6. For each joystick: a. Go up to its input parent device b. Check that the phys attribute matches HID_PHYS, if so, store the joystick device number. 7. Set leds 8. If the Sixaxis is connected via USB do the cable pairing. My doubt is about 5. and 6a.: I have go deep in the hierarchy down to