From: Manuel Reimer <mail+linux-input@m-reimer.de>
To: linux-input <linux-input@vger.kernel.org>
Subject: What's the difference between hid_hw_output_report and hid_hw_raw_request?
Date: Sat, 23 Apr 2016 16:05:45 +0200 [thread overview]
Message-ID: <a0f08d24-0d11-7816-603d-2a198ee60caa@m-reimer.de> (raw)
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);
next reply other threads:[~2016-04-23 14:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-23 14:05 Manuel Reimer [this message]
2016-04-23 14:56 ` What's the difference between hid_hw_output_report and hid_hw_raw_request? Clément VUCHENER
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0f08d24-0d11-7816-603d-2a198ee60caa@m-reimer.de \
--to=mail+linux-input@m-reimer.de \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).