From: Antonio Ospite <ospite@studenti.unina.it>
To: linux-input@vger.kernel.org
Cc: Antonio Ospite <ospite@studenti.unina.it>,
linux-bluetooth@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>,
Marcel Holtmann <marcel@holtmann.org>,
"Gustavo F. Padovan" <padovan@profusion.mobi>,
Bastien Nocera <hadess@hadess.net>, Alan Ott <alan@signal11.us>,
Jim Paris <jim@jtan.com>, "pascal@pabr.org" <pascal@pabr.org>
Subject: [PATCH 0/2] Fix sending Output reports to the Sony Sixaxis
Date: Sun, 20 Feb 2011 18:26:44 +0100 [thread overview]
Message-ID: <1298222806-19433-1-git-send-email-ospite@studenti.unina.it> (raw)
In-Reply-To: <alpine.LNX.2.00.1102180944590.2160@pobox.suse.cz>
Hi,
an Output report is used to set LEDs on the Sony Sixaxis controller, but
the device is quite picky about how it wants the Output report to be
sent, so these patches attempt to overcome the Sixaxis deficiencies.
The first patch is OK to apply, even for 2.6.38 I think.
For the second one I'd really like an actual test with other devices
supporting HID Output reports over BT, I don't want to break anything
even if the change looks sane as per the BT HID specification.
Something equivalent to the second patch should be implemented as an
override in hid-sony.c as well, in order to be protected from future
improvements to hidp_output_raw_report(), but for that to work I need to
make hidp_send_ctrl_message() public and I don't know if you'll like
that, we'll see in a patch to come.
Antonio Ospite (2):
hid-sony.c: Fix sending Output reports to the Sixaxis
bt hidp: send Output reports using SET_REPORT on the Control channel
drivers/hid/hid-sony.c | 20 ++++++++++++++++++++
net/bluetooth/hidp/core.c | 2 +-
2 files changed, 21 insertions(+), 1 deletions(-)
FYI, this is how I am setting leds on the Sixaxis, the same code works
with hidraw via usb and bluetooth after the patches above are applied:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define LED_1 (0x01 << 1)
#define LED_2 (0x01 << 2)
#define LED_3 (0x01 << 3)
#define LED_4 (0x01 << 4)
void set_leds(int fd, unsigned char led_status[4])
{
int ret;
unsigned char change_leds[] = {
0x01,
0x00, 0x00, 0x00, 0x00, 0x00, // rumble values TBD.
0x00, 0x00, 0x00, 0x00, 0x1e,
0xff, 0x27, 0x10, 0x00, 0x32, // LED 4
0xff, 0x27, 0x10, 0x00, 0x32, // LED 3
0xff, 0x27, 0x10, 0x00, 0x32, // LED 2
0xff, 0x27, 0x10, 0x00, 0x32, // LED 1
0x00, 0x00, 0x00, 0x00, 0x00,
};
int led = 0;
if (led_status[0])
led |= LED_1;
if (led_status[1])
led |= LED_2;
if (led_status[2])
led |= LED_3;
if (led_status[3])
led |= LED_4;
printf("led: 0x%02x\n", led);
change_leds[10] = led;
ret = write(fd, change_leds, sizeof(change_leds));
if (ret < (ssize_t) sizeof(change_leds)) {
close(fd);
perror("Unable to write to hidraw device");
exit(EXIT_FAILURE);
}
}
int main(int argc, char *argv[])
{
int fd;
unsigned char led_status[4] = { 1, 0, 0, 0 };
if (argc != 2) {
fprintf(stderr, "usage: %s </dev/hidrawX>\n", argv[0]);
exit(1);
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
perror("open");
exit(1);
}
set_leds(fd, led_status);
return 0;
}
--
Antonio Ospite
http://ao2.it
PGP public key ID: 0x4553B001
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
next prev parent reply other threads:[~2011-02-20 17:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 13:54 hidp_output_raw_report, HID_OUTPUT_REPORT and Sixaxis Antonio Ospite
2010-11-30 14:06 ` Antonio Ospite
2010-11-30 17:40 ` pascal
2010-12-01 21:06 ` Antonio Ospite
2010-12-01 22:40 ` pascal
2011-02-17 14:19 ` Antonio Ospite
[not found] ` <20110217151931.d7ee7e29.ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2011-02-18 8:45 ` Jiri Kosina
2011-02-20 17:26 ` Antonio Ospite [this message]
2011-02-20 17:26 ` [PATCH 1/2] hid-sony.c: Fix sending Output reports to the Sixaxis Antonio Ospite
2011-02-21 12:49 ` Jiri Kosina
2011-02-20 17:26 ` [PATCH 2/2] bt hidp: send Output reports using SET_REPORT on the Control channel Antonio Ospite
[not found] ` <1298222806-19433-3-git-send-email-ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2011-02-21 3:45 ` Alan Ott
2011-02-21 12:50 ` Jiri Kosina
2011-02-21 21:09 ` Gustavo F. Padovan
2011-02-22 10:09 ` Jiri Kosina
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=1298222806-19433-1-git-send-email-ospite@studenti.unina.it \
--to=ospite@studenti.unina.it \
--cc=alan@signal11.us \
--cc=hadess@hadess.net \
--cc=jim@jtan.com \
--cc=jkosina@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=padovan@profusion.mobi \
--cc=pascal@pabr.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).