Skip to content

Commit

Permalink
Merge branches 'for-3.11/wacom-fixed' and 'for-3.11/wiimote' into for…
Browse files Browse the repository at this point in the history
…-linus
  • Loading branch information
Jiri Kosina committed Jul 4, 2013
3 parents 08ec2dc + 9d15762 + b8e0fe3 commit 21796b3
Show file tree
Hide file tree
Showing 10 changed files with 3,468 additions and 1,458 deletions.
39 changes: 38 additions & 1 deletion Documentation/ABI/testing/sysfs-driver-hid-wiimote
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,48 @@ Description: Make it possible to set/get current led state. Reading from it
What: /sys/bus/hid/drivers/wiimote/<dev>/extension
Date: August 2011
KernelVersion: 3.2
Contact: David Herrmann <dh.herrmann@googlemail.com>
Contact: David Herrmann <dh.herrmann@gmail.com>
Description: This file contains the currently connected and initialized
extensions. It can be one of: none, motionp, nunchuck, classic,
motionp+nunchuck, motionp+classic
motionp is the official Nintendo Motion+ extension, nunchuck is
the official Nintendo Nunchuck extension and classic is the
Nintendo Classic Controller extension. The motionp extension can
be combined with the other two.
Starting with kernel-version 3.11 Motion Plus hotplugging is
supported and if detected, it's no longer reported as static
extension. You will get uevent notifications for the motion-plus
device then.

What: /sys/bus/hid/drivers/wiimote/<dev>/devtype
Date: May 2013
KernelVersion: 3.11
Contact: David Herrmann <dh.herrmann@gmail.com>
Description: While a device is initialized by the wiimote driver, we perform
a device detection and signal a "change" uevent after it is
done. This file shows the detected device type. "pending" means
that the detection is still ongoing, "unknown" means, that the
device couldn't be detected or loaded. "generic" means, that the
device couldn't be detected but supports basic Wii Remote
features and can be used.
Other strings for each device-type are available and may be
added if new device-specific detections are added.
Currently supported are:
gen10: First Wii Remote generation
gen20: Second Wii Remote Plus generation (builtin MP)
balanceboard: Wii Balance Board

What: /sys/bus/hid/drivers/wiimote/<dev>/bboard_calib
Date: May 2013
KernelVersion: 3.11
Contact: David Herrmann <dh.herrmann@gmail.com>
Description: This attribute is only provided if the device was detected as a
balance board. It provides a single line with 3 calibration
values for all 4 sensors. The values are separated by colons and
are each 2 bytes long (encoded as 4 digit hexadecimal value).
First, 0kg values for all 4 sensors are written, followed by the
17kg values for all 4 sensors and last the 34kg values for all 4
sensors.
Calibration data is already applied by the kernel to all input
values but may be used by user-space to perform other
transformations.
27 changes: 17 additions & 10 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -719,22 +719,29 @@ config HID_WACOM
Support for Wacom Graphire Bluetooth and Intuos4 WL tablets.

config HID_WIIMOTE
tristate "Nintendo Wii Remote support"
tristate "Nintendo Wii / Wii U peripherals"
depends on HID
depends on LEDS_CLASS
select POWER_SUPPLY
select INPUT_FF_MEMLESS
---help---
Support for the Nintendo Wii Remote bluetooth device.
Support for Nintendo Wii and Wii U Bluetooth peripherals. Supported
devices are the Wii Remote and its extension devices, but also devices
based on the Wii Remote like the Wii U Pro Controller or the
Wii Balance Board.

config HID_WIIMOTE_EXT
bool "Nintendo Wii Remote Extension support"
depends on HID_WIIMOTE
default HID_WIIMOTE
---help---
Support for extension controllers of the Nintendo Wii Remote. Say yes
here if you want to use the Nintendo Motion+, Nunchuck or Classic
extension controllers with your Wii Remote.
Support for all official Nintendo extensions is available, however, 3rd
party extensions might not be supported. Please report these devices to:
http://github.com/dvdhrm/xwiimote/issues

Other Nintendo Wii U peripherals that are IEEE 802.11 based (including
the Wii U Gamepad) might be supported in the future. But currently
support is limited to Bluetooth based devices.

If unsure, say N.

To compile this driver as a module, choose M here: the
module will be called hid-wiimote.

config HID_ZEROPLUS
tristate "Zeroplus based game controller support"
Expand Down
5 changes: 1 addition & 4 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ ifdef CONFIG_LOGIWHEELS_FF
hid-logitech-y += hid-lg4ff.o
endif

hid-wiimote-y := hid-wiimote-core.o
ifdef CONFIG_HID_WIIMOTE_EXT
hid-wiimote-y += hid-wiimote-ext.o
endif
hid-wiimote-y := hid-wiimote-core.o hid-wiimote-modules.o
ifdef CONFIG_DEBUG_FS
hid-wiimote-y += hid-wiimote-debug.o
endif
Expand Down
14 changes: 13 additions & 1 deletion drivers/hid/hid-wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct wacom_data {
__u8 battery_capacity;
__u8 power_raw;
__u8 ps_connected;
__u8 bat_charging;
struct power_supply battery;
struct power_supply ac;
__u8 led_selector;
Expand All @@ -62,6 +63,7 @@ static enum power_supply_property wacom_battery_props[] = {
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_SCOPE,
POWER_SUPPLY_PROP_STATUS,
};

static enum power_supply_property wacom_ac_props[] = {
Expand Down Expand Up @@ -287,6 +289,15 @@ static int wacom_battery_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_CAPACITY:
val->intval = wdata->battery_capacity;
break;
case POWER_SUPPLY_PROP_STATUS:
if (wdata->bat_charging)
val->intval = POWER_SUPPLY_STATUS_CHARGING;
else
if (wdata->battery_capacity == 100 && wdata->ps_connected)
val->intval = POWER_SUPPLY_STATUS_FULL;
else
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break;
default:
ret = -EINVAL;
break;
Expand Down Expand Up @@ -727,7 +738,8 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
if (power_raw != wdata->power_raw) {
wdata->power_raw = power_raw;
wdata->battery_capacity = batcap_i4[power_raw & 0x07];
wdata->ps_connected = power_raw & 0x08;
wdata->bat_charging = (power_raw & 0x08) ? 1 : 0;
wdata->ps_connected = (power_raw & 0x10) ? 1 : 0;
}

break;
Expand Down
Loading

0 comments on commit 21796b3

Please sign in to comment.