linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Praznik <frank.praznik@gmail.com>
To: Pavel Machek <pavel@ucw.cz>, Jiri Kosina <jkosina@suse.cz>
Cc: vojtech@suse.cz, mike-@cinci.rr.com, jslaby@suse.cz,
	dave@thedillows.org, colin.leitner@gmail.com,
	kernel list <linux-kernel@vger.kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: Turn Sony motion controller into RGB led
Date: Thu, 09 Apr 2015 20:33:23 -0400	[thread overview]
Message-ID: <55271A53.6080505@gmail.com> (raw)
In-Reply-To: <20150409212536.GA1440@amd>

On 4/9/2015 17:25, Pavel Machek wrote:
> Hi!
>
> I did not yet figure out how to get sensor data from the controller,
> but it works rather well as a RGB led.

Hi Pavel,

 From what I've read, the motion controller only sends sensor data when 
connected via bluetooth.
Otherwise it should be in report 1 with the buttons and other data.

Jiri already covered many of the issues, so just a couple of comments on 
top of what he already wrote:

>   
> -static __u8 *ps3remote_fixup(struct hid_device *hdev, __u8 *rdesc,
> +static int motion_set_leds(struct hid_device *hdev, u8 r, u8 g, u8 b)
> +{
> +	int ret;
> +	struct motion_leds *buf = kzalloc(sizeof(struct motion_leds), GFP_KERNEL);

The other devices allocate this buffer up front and store it in 
output_report_dmabuf in the sony_sc struct
to avoid hitting the allocator every time an output report is sent. No 
reason why the motion controller can't
do the same.  Add an entry in sony_allocate_output_report() and it will 
be automatically freed when the
device is removed.

> +
> +	if (sizeof(struct motion_leds) != 7) {
> +		printk("Struct has bad size\n");
> +	}
> +

On the printk usage in general: the rest of the driver uses 
hid_info/hid_err to automatically format the output
string with the driver/device information when printing log messages.  
Use these instead of printk for consistency.
A lot of them should be removed anyways since they look like debugging 
leftovers.

If you can send a version without all of the unrelated underscore 
changes I'll help clean it up.  I don't own one of these controllers
though, so I can't help test the functionality.

  parent reply	other threads:[~2015-04-10  0:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14 19:19 Fun with sony motion controllers: navigation controller Pavel Machek
2015-03-14 19:23 ` Fun with sony motion controllers: motion controller Pavel Machek
2015-03-14 20:53   ` Pavel Machek
2015-03-14 19:31 ` Fun with sony motion controllers: dualshock Pavel Machek
2015-03-14 19:47 ` Fun with sony motion controllers: navigation controller Pavel Machek
2015-03-14 20:54 ` [PATCH] hid-sony: underscores are unneccessary for u8, u16 Pavel Machek
2015-03-16 12:55 ` Fun with sony motion controllers: navigation controller Jiri Kosina
2015-03-16 13:05   ` Pavel Machek
2015-03-16 13:55     ` Jiri Kosina
2015-03-16 15:26       ` Frank Praznik
2015-03-16 22:28         ` Pavel Machek
2015-04-09 21:25     ` Turn Sony motion controller into RGB led Pavel Machek
2015-04-09 21:50       ` Jiri Kosina
2015-04-10  0:33       ` Frank Praznik [this message]
2015-04-24 12:53         ` Pavel Machek
2015-04-24 13:51         ` Pavel Machek

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=55271A53.6080505@gmail.com \
    --to=frank.praznik@gmail.com \
    --cc=colin.leitner@gmail.com \
    --cc=dave@thedillows.org \
    --cc=jkosina@suse.cz \
    --cc=jslaby@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike-@cinci.rr.com \
    --cc=pavel@ucw.cz \
    --cc=vojtech@suse.cz \
    /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).