[RFC] raw output buffering in HID layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I currently work on an HID driver for the Nintendo Wii Remote as Bluez GSoC
project. The Wii Remote (further wiimote) is a small wireless device
that communicates
with the host via bluetooth. It uses the HID ports but does not provide any
proper HID descriptor sets and doesn't really fit into the HID class so a
special driver is needed to control the device.
See [1], [2] and [3] for device details if required.

Since the wiimote protocol requires the host to send complex memory
read/write commands
to the wiimote, I need to use the raw hid interface. I use the
.raw_event callback
to get access to the raw input events, however, I also need to send
raw events to
the device.
The HIDRAW driver does exactly that. It uses:
  ret = dev->hid_output_raw_report(dev, buf, count, report_type);
However, this function may block and my HID driver, obviously, needs
to send commands
in atomic context. Therefore, I implemented a buffer which is sent to the device
in a workqueue via hid_output_raw_report.

No driver in the drivers/hid/ directory uses a workqueue, though, I
can't figure out any
other way to solve my problems here. I intend to submit the first
patchset to this list
to get this driver upstream but I want to go sure that using a
workqueue here is ok.

See [4] for my hid driver which is located at
drivers/hid/hid-wiimote.c. The related
patch that introduces the buffered out-queue is [5].

If there is any other way to send complex HID output reports to a
device other than the
hid_output_raw_report() function, I could rewrite this, but the
wiimote protocol really
requires this functionality and I couldn't find any other HID driver
that has similar
requirements.

Any comments are appreciated.
Kind regards

David


[1] General Device information: http://en.wikipedia.org/wiki/Wiimote
[2] Reverse-Engineered Protocol: http://wiibrew.org/wiki/Wiimote
[3] Bluetooth-Details:
https://github.com/dvdhrm/xwiimote/blob/master/doc/PROTOCOL
[4] My tree (based on jikos/master): https://github.com/dvdhrm/xwiimote_kernel
[5] Workqueue patch:
https://github.com/dvdhrm/xwiimote_kernel/commit/e8ac07bb2bff7e470a959d44db051d23dc5b0a60
[6] My userspace tools: https://github.com/dvdhrm/xwiimote
--
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


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux