linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What's the difference between hid_hw_output_report and hid_hw_raw_request?
@ 2016-04-23 14:05 Manuel Reimer
  2016-04-23 14:56 ` Clément VUCHENER
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Reimer @ 2016-04-23 14:05 UTC (permalink / raw)
  To: linux-input

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?

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-23 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-23 14:05 What's the difference between hid_hw_output_report and hid_hw_raw_request? Manuel Reimer
2016-04-23 14:56 ` Clément VUCHENER

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).