Re: What's the difference between hid_hw_output_report and hid_hw_raw_request?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2016-04-23 16:05 GMT+02:00 Manuel Reimer <mail+linux-input@xxxxxxxxxxx>:
> Hello,
>
> I want to enable the rumble motors on a PS4 controller using libusb.
>
> The kernel code calls different functions depending on whether USB or
> Bluetooth is used:
> https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c#L1901
> This difference does not exist in the code for the PS3 controller.
>
> So why is this difference in the kernel driver? What do I have to do to
> emulate "hid_hw_output_report" using libusb?

If I understand the code from hid-core.c correctly,
usbhid_output_report sends the report using the interrupt out pipe
instead of a control transfer. Check if the USB descriptor for your
device declares an interrupt out endpoint and use it if it exists.

>
> Thanks in advance.
>
> Manuel
>
>
> My current code, which does *not* work, follows. I also tried to not send
> the report ID as first byte in the command sequence, but this doesn't work
> either. The data seems to get sent without any problems, but the controller
> doesn't react in any way.
>
>  uint8_t cmd[] = {
>     0x05,
>     0xFF, 0x00, 0x00, right, left,  // rumble values
>     0xFF, 0xFF, 0xFF, 0x00, 0x00,  // Red, Green, Blue, TimeBright, TimeDark
>     0x00, 0x00, 0x00, 0x00, 0x00,
>     0x00, 0x00, 0x00, 0x00, 0x00,
>     0x00, 0x00, 0x00, 0x00, 0x00,
>     0x00, 0x00, 0x00, 0x00, 0x00,
>     0x00
>   };
>
>   return libusb_control_transfer(usbdev,
>                         LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS |
> LIBUSB_RECIPIENT_INTERFACE,
>                         HID_REQ_SET_REPORT,
>                         (HID_OUTPUT_REPORT<<8)|0x05,
>                         0,
>                         cmd,
>                         sizeof(cmd),
>                         USB_CTRL_GET_TIMEOUT);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux