[RFC] Wiimote userspace interface

Started by David Herrmann on Jul 30, 2011 · 7 messages from 4 authors · Last reply Aug 10, 2011

open the first message on its own page

Message details and related content
Hi

As Oliver pointed out my proposed wiimote userspace interface isn't
exactly the best way to go so I wanted to discuss possible interfaces
first.

The following data is reported by the wiimote to userspace:
 - Button data
 - 3D accelerometer data (1x)
 - 2D pointing data through IR cam (4x)

By motion+ extension:
 - 3D gyro/rotation data (1x)

By nunchuck extension:
 - 2D analog stick data (1x)
 - additional buttons
 - 3D accelerometer data (1x)

By classic controller extension:
 - additional buttons
 - 2D analog stick (2x)

To be extended with further wiimote extensions

Obviously this is way too much data for a single interface. Its 23
ABS_ values (4x IR cam!). I could report them through one interface
but I had to use my own ABS_ values which are not in input.h since
there aren't enough predefined values.

Additionally, the driver is capable of disabling the accelerometers,
IR cam, gyro etc. on the remote device to save energy (a *lot* of
energy). So I really want to enable these devices only if userspace
uses them.


Interface #1:
Everything is reported through one input device and there are sysfs
attributes which control the peripherals of the wiimote. Eg., writing
1 to "accelerometer" enables the accelerometer. Writing 0 disables it.

70 more lines

Message details and related content
Hi David,

On Sat, Jul 30, 2011 at 06:34:37PM +0200, David Herrmann wrote:
Hi

As Oliver pointed out my proposed wiimote userspace interface isn't
exactly the best way to go so I wanted to discuss possible interfaces
first.

The following data is reported by the wiimote to userspace:
 - Button data
 - 3D accelerometer data (1x)
 - 2D pointing data through IR cam (4x)

By motion+ extension:
 - 3D gyro/rotation data (1x)

By nunchuck extension:
 - 2D analog stick data (1x)
 - additional buttons
 - 3D accelerometer data (1x)

By classic controller extension:
 - additional buttons
 - 2D analog stick (2x)

To be extended with further wiimote extensions

Obviously this is way too much data for a single interface. Its 23
ABS_ values (4x IR cam!). I could report them through one interface
but I had to use my own ABS_ values which are not in input.h since
there aren't enough predefined values.

Additionally, the driver is capable of disabling the accelerometers,
IR cam, gyro etc. on the remote device to save energy (a *lot* of
energy). So I really want to enable these devices only if userspace
uses them.


Interface #1:
Everything is reported through one input device and there are sysfs
attributes which control the peripherals of the wiimote. Eg., writing
1 to "accelerometer" enables the accelerometer. Writing 0 disables it.

57 more quoted lines

Depending on what exactly it is you may try registering LEDs as LED
class devices. Having a sysfs attribute to light one of 4 leds is an
option too.
and RUMBLE motor is ok? I can't figure out any better way here.
One of the input devices should be registered as ForceFeedback device
(or you create a separate FF input device).
Reference-counting doesn't make sense. If multiple devices use them,
then they will always have conflicts, however, it still works.
Audio streaming is not yet implemented, but I think I could register
an alsa device so this needs not to be discussed here.


Currently I think Interface #2 would be the best way but I don't want
to spend time implementing that if you tell me it isn't acceptable.
Any comments on this are appreciated.
I believe you should try presenting physical objects as input devices so
I'd try presenting wiimote (with optional motion+ events) as one device
and accessory (nunchuck, classic extension) as another device.

The IR Cam data is a concern. Could you please describe a bit more what
is being reported by the cam?

Thanks.

-- 
Dmitry
Message details and related content
Hi Dmitry

On Wed, Aug 3, 2011 at 8:17 AM, Dmitry Torokhov
[off-list ref] wrote:
Hi David,

On Sat, Jul 30, 2011 at 06:34:37PM +0200, David Herrmann wrote:
quoted
There is also the other side. Sending data to the wiimote. 4 LEDs can
be set, the rumble motor can be enabled/disabled and audio data can be
streamed. I think my current approach to use sysfs attributes for the
LEDs
Depending on what exactly it is you may try registering LEDs as LED
class devices. Having a sysfs attribute to light one of 4 leds is an
option too.
I already looked at the API. Although the 4 LEDs of the wiimote can
only be switched on/off (no brightness modulation) I think I could
register 4 led_classdev structures. This would also allow software
blinking.
quoted
and RUMBLE motor is ok? I can't figure out any better way here.
One of the input devices should be registered as ForceFeedback device
(or you create a separate FF input device).
Ok, I will add that.
quoted
Reference-counting doesn't make sense. If multiple devices use them,
then they will always have conflicts, however, it still works.
Audio streaming is not yet implemented, but I think I could register
an alsa device so this needs not to be discussed here.


Currently I think Interface #2 would be the best way but I don't want
to spend time implementing that if you tell me it isn't acceptable.
Any comments on this are appreciated.
I believe you should try presenting physical objects as input devices so
I'd try presenting wiimote (with optional motion+ events) as one device
and accessory (nunchuck, classic extension) as another device.
Yes, but the problem is, that this would enable all peripherals of the
wiimote, even though userspace may not need them. But if that is the
recommended way, I will implement it.
The IR Cam data is a concern. Could you please describe a bit more what
is being reported by the cam?
The IR cam tracks IR-LEDs. Up to 4 leds. It reports them as 2D
coordinates. The values can be used to use the wiimote with the
integrated cam as pointing device, but may also be used for other
purposes so I don't want to handle the IR values in the driver but
rather provide them to userspace.
Thanks.

--
Dmitry
Regards
David
Message details and related content
On Wed, 3 Aug 2011, David Herrmann wrote:
quoted
quoted
There is also the other side. Sending data to the wiimote. 4 LEDs can
be set, the rumble motor can be enabled/disabled and audio data can be
streamed. I think my current approach to use sysfs attributes for the
LEDs
Depending on what exactly it is you may try registering LEDs as LED
class devices. Having a sysfs attribute to light one of 4 leds is an
option too.
I already looked at the API. Although the 4 LEDs of the wiimote can
only be switched on/off (no brightness modulation) I think I could
register 4 led_classdev structures. This would also allow software
blinking.
Yes, I'd prefer that as well.
quoted
quoted
and RUMBLE motor is ok? I can't figure out any better way here.
One of the input devices should be registered as ForceFeedback device
(or you create a separate FF input device).
Ok, I will add that.
Perfect, thanks. You can find quite some examples of force feedback 
implementations even in drivers/hid as well, to gain some inspiration.
quoted
quoted
Reference-counting doesn't make sense. If multiple devices use them,
then they will always have conflicts, however, it still works.
Audio streaming is not yet implemented, but I think I could register
an alsa device so this needs not to be discussed here.


Currently I think Interface #2 would be the best way but I don't want
to spend time implementing that if you tell me it isn't acceptable.
Any comments on this are appreciated.
I believe you should try presenting physical objects as input devices so
I'd try presenting wiimote (with optional motion+ events) as one device
and accessory (nunchuck, classic extension) as another device.
Yes, but the problem is, that this would enable all peripherals of the
wiimote, even though userspace may not need them. But if that is the
recommended way, I will implement it.
Is there any problem with that? I could potentialy imagine unnecessary 
power consumption (assuming that the peripherals that are not enabled are 
in some lower state, right?). Anything else?

Thanks a lot for your work on the driver, David.

-- 
Jiri Kosina
SUSE Labs
Message details and related content
On Wed, 10 Aug 2011, Jiri Kosina wrote:
Thanks a lot for your work on the driver, David.
... so I am now postponing the merge of the series you have sent, and 
waiting for your respin, okay?

Thanks again,

-- 
Jiri Kosina
SUSE Labs
Message details and related content
On Wed, Aug 10, 2011 at 2:00 PM, Jiri Kosina [off-list ref] wrote:
On Wed, 10 Aug 2011, Jiri Kosina wrote:
quoted
Thanks a lot for your work on the driver, David.
... so I am now postponing the merge of the series you have sent, and
waiting for your respin, okay?
Yes, I will resend the patches with the new interface and probably
include the extension-support with it as I have almost finished that.

Thanks for your hints and yeah, power-consumption was the only problem
with this interface but I think I can implement some power-savings
later if it turns out to be an issue.
Thanks again,

--
Jiri Kosina
SUSE Labs
Regards
David
Message details and related content
Am Mittwoch, 10. August 2011, 15:37:32 schrieb David Herrmann:
On Wed, Aug 10, 2011 at 2:00 PM, Jiri Kosina [off-list ref] wrote:
quoted
On Wed, 10 Aug 2011, Jiri Kosina wrote:
quoted
Thanks a lot for your work on the driver, David.
... so I am now postponing the merge of the series you have sent, and
waiting for your respin, okay?
Yes, I will resend the patches with the new interface and probably
include the extension-support with it as I have almost finished that.

Thanks for your hints and yeah, power-consumption was the only problem
with this interface but I think I can implement some power-savings
later if it turns out to be an issue.
It is much easier to do that at the beginning. Redesign is usually painful.

	Regards
		Oliver
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help