@@ -834,7 +834,7 @@ static void wiimote_init_set_type(struct wiimote_data *wdata,
__u8 leds;
__u16 vendor, product;
const char *name;
- int device_id;
+ int device_id = -1;
vendor = wdata->hdev->vendor;
product = wdata->hdev->product;
@@ -882,12 +882,18 @@ static void wiimote_init_set_type(struct wiimote_data *wdata,
wiimote_modules_load(wdata, devtype);
- /* set player number to stop initial LED-blinking */
- device_id = ida_simple_get(&wiimote_device_id_allocator, 0, 0,
- GFP_KERNEL);
+ /* Set player number to stop initial LED blinking.
+ * Wii Balance Board has a single LED, so don't get
+ * a player ID for balance boards.
+ */
+ if (devtype != WIIMOTE_DEV_BALANCE_BOARD)
+ device_id = ida_simple_get(&wiimote_device_id_allocator,
+ 0, 0, GFP_KERNEL);
+
if (device_id < 0) {
- /* Unable to get a device ID. */
- /* Set LED1 anyway to stop the blinking. */
+ /* Unable to get a device ID, or this is a Wii Balance Board.
+ * Set LED1 anyway to stop the blinking.
+ */
leds = WIIPROTO_FLAG_LED1;
wdata->device_id = -1;
} else {
Wii Balance Boards only have a single LED, so the player number can't be displayed on the board itself. Don't bother allocating a device ID in this case. Note that on the actual Wii system, only one board can usually be connected at a time, and it's listed as Player 4 on the HOME Menu. Signed-off-by: David Korth <gerbilsoft@gerbilsoft.com> --- drivers/hid/hid-wiimote-core.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)