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.
--
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