Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 21796b3

Browse files
author
Jiri Kosina
committed
Merge branches 'for-3.11/wacom-fixed' and 'for-3.11/wiimote' into for-linus
3 parents 08ec2dc + 9d15762 + b8e0fe3 commit 21796b3

File tree

10 files changed

+3468
-1458
lines changed

10 files changed

+3468
-1458
lines changed

Documentation/ABI/testing/sysfs-driver-hid-wiimote

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,48 @@ Description: Make it possible to set/get current led state. Reading from it
1212
What: /sys/bus/hid/drivers/wiimote/<dev>/extension
1313
Date: August 2011
1414
KernelVersion: 3.2
15-
Contact: David Herrmann <dh.herrmann@googlemail.com>
15+
Contact: David Herrmann <dh.herrmann@gmail.com>
1616
Description: This file contains the currently connected and initialized
1717
extensions. It can be one of: none, motionp, nunchuck, classic,
1818
motionp+nunchuck, motionp+classic
1919
motionp is the official Nintendo Motion+ extension, nunchuck is
2020
the official Nintendo Nunchuck extension and classic is the
2121
Nintendo Classic Controller extension. The motionp extension can
2222
be combined with the other two.
23+
Starting with kernel-version 3.11 Motion Plus hotplugging is
24+
supported and if detected, it's no longer reported as static
25+
extension. You will get uevent notifications for the motion-plus
26+
device then.
27+
28+
What: /sys/bus/hid/drivers/wiimote/<dev>/devtype
29+
Date: May 2013
30+
KernelVersion: 3.11
31+
Contact: David Herrmann <[email protected]>
32+
Description: While a device is initialized by the wiimote driver, we perform
33+
a device detection and signal a "change" uevent after it is
34+
done. This file shows the detected device type. "pending" means
35+
that the detection is still ongoing, "unknown" means, that the
36+
device couldn't be detected or loaded. "generic" means, that the
37+
device couldn't be detected but supports basic Wii Remote
38+
features and can be used.
39+
Other strings for each device-type are available and may be
40+
added if new device-specific detections are added.
41+
Currently supported are:
42+
gen10: First Wii Remote generation
43+
gen20: Second Wii Remote Plus generation (builtin MP)
44+
balanceboard: Wii Balance Board
45+
46+
What: /sys/bus/hid/drivers/wiimote/<dev>/bboard_calib
47+
Date: May 2013
48+
KernelVersion: 3.11
49+
Contact: David Herrmann <[email protected]>
50+
Description: This attribute is only provided if the device was detected as a
51+
balance board. It provides a single line with 3 calibration
52+
values for all 4 sensors. The values are separated by colons and
53+
are each 2 bytes long (encoded as 4 digit hexadecimal value).
54+
First, 0kg values for all 4 sensors are written, followed by the
55+
17kg values for all 4 sensors and last the 34kg values for all 4
56+
sensors.
57+
Calibration data is already applied by the kernel to all input
58+
values but may be used by user-space to perform other
59+
transformations.

drivers/hid/Kconfig

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -719,22 +719,29 @@ config HID_WACOM
719719
Support for Wacom Graphire Bluetooth and Intuos4 WL tablets.
720720

721721
config HID_WIIMOTE
722-
tristate "Nintendo Wii Remote support"
722+
tristate "Nintendo Wii / Wii U peripherals"
723723
depends on HID
724724
depends on LEDS_CLASS
725725
select POWER_SUPPLY
726726
select INPUT_FF_MEMLESS
727727
---help---
728-
Support for the Nintendo Wii Remote bluetooth device.
728+
Support for Nintendo Wii and Wii U Bluetooth peripherals. Supported
729+
devices are the Wii Remote and its extension devices, but also devices
730+
based on the Wii Remote like the Wii U Pro Controller or the
731+
Wii Balance Board.
729732

730-
config HID_WIIMOTE_EXT
731-
bool "Nintendo Wii Remote Extension support"
732-
depends on HID_WIIMOTE
733-
default HID_WIIMOTE
734-
---help---
735-
Support for extension controllers of the Nintendo Wii Remote. Say yes
736-
here if you want to use the Nintendo Motion+, Nunchuck or Classic
737-
extension controllers with your Wii Remote.
733+
Support for all official Nintendo extensions is available, however, 3rd
734+
party extensions might not be supported. Please report these devices to:
735+
http://github.com/dvdhrm/xwiimote/issues
736+
737+
Other Nintendo Wii U peripherals that are IEEE 802.11 based (including
738+
the Wii U Gamepad) might be supported in the future. But currently
739+
support is limited to Bluetooth based devices.
740+
741+
If unsure, say N.
742+
743+
To compile this driver as a module, choose M here: the
744+
module will be called hid-wiimote.
738745

739746
config HID_ZEROPLUS
740747
tristate "Zeroplus based game controller support"

drivers/hid/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ ifdef CONFIG_LOGIWHEELS_FF
2828
hid-logitech-y += hid-lg4ff.o
2929
endif
3030

31-
hid-wiimote-y := hid-wiimote-core.o
32-
ifdef CONFIG_HID_WIIMOTE_EXT
33-
hid-wiimote-y += hid-wiimote-ext.o
34-
endif
31+
hid-wiimote-y := hid-wiimote-core.o hid-wiimote-modules.o
3532
ifdef CONFIG_DEBUG_FS
3633
hid-wiimote-y += hid-wiimote-debug.o
3734
endif

drivers/hid/hid-wacom.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct wacom_data {
4646
__u8 battery_capacity;
4747
__u8 power_raw;
4848
__u8 ps_connected;
49+
__u8 bat_charging;
4950
struct power_supply battery;
5051
struct power_supply ac;
5152
__u8 led_selector;
@@ -62,6 +63,7 @@ static enum power_supply_property wacom_battery_props[] = {
6263
POWER_SUPPLY_PROP_PRESENT,
6364
POWER_SUPPLY_PROP_CAPACITY,
6465
POWER_SUPPLY_PROP_SCOPE,
66+
POWER_SUPPLY_PROP_STATUS,
6567
};
6668

6769
static enum power_supply_property wacom_ac_props[] = {
@@ -287,6 +289,15 @@ static int wacom_battery_get_property(struct power_supply *psy,
287289
case POWER_SUPPLY_PROP_CAPACITY:
288290
val->intval = wdata->battery_capacity;
289291
break;
292+
case POWER_SUPPLY_PROP_STATUS:
293+
if (wdata->bat_charging)
294+
val->intval = POWER_SUPPLY_STATUS_CHARGING;
295+
else
296+
if (wdata->battery_capacity == 100 && wdata->ps_connected)
297+
val->intval = POWER_SUPPLY_STATUS_FULL;
298+
else
299+
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
300+
break;
290301
default:
291302
ret = -EINVAL;
292303
break;
@@ -727,7 +738,8 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
727738
if (power_raw != wdata->power_raw) {
728739
wdata->power_raw = power_raw;
729740
wdata->battery_capacity = batcap_i4[power_raw & 0x07];
730-
wdata->ps_connected = power_raw & 0x08;
741+
wdata->bat_charging = (power_raw & 0x08) ? 1 : 0;
742+
wdata->ps_connected = (power_raw & 0x10) ? 1 : 0;
731743
}
732744

733745
break;

0 commit comments

Comments
 (0)