- 18 10月, 2013 1 次提交
-
-
由 Nikolai Kondrashov 提交于
Revert some changes done in 77463838. Revert all changes done in hidinput_calc_abs_res as it mistakingly used "Unit" item exponent nibbles to affect resolution value. This wasn't breaking resolution calculation of relevant axes of any existing devices, though, as they have only one dimension to their units and thus 1 in the corresponding nible. Revert to reading "Unit Exponent" item value as a signed integer in hid_parser_global to fix reading specification-complying values. This fixes resolution calculation of devices complying to the HID standard, including Huion, KYE, Waltop and UC-Logic graphics tablets which have their report descriptors fixed by the drivers. Explanations follow. There are two "unit exponents" in HID specification and it is important not to mix them. One is the global "Unit Exponent" item and another is nibble values in the global "Unit" item. See 6.2.2.7 Global Items. The "Unit Exponent" value is just a signed integer and is used to scale the integer resolution unit values, so fractions can be expressed. The nibbles of "Unit" value are used to select the unit system (nibble 0), and presence of a particular basic unit type in the unit formula and its *exponent* (or power, nibbles 1-6). And yes, the latter is in two complement and zero means absence of the unit type. Taking the representation example of (integer) joules from the specification: [mass(grams)][length(centimeters)^2][time(seconds)^-2] * 10^-7 the "Unit Exponent" would be -7 (or 0xF9, if stored as a byte) and the "Unit" value would be 0xE121, signifying: Nibble Part Value Meaning ----- ---- ----- ------- 0 System 1 SI Linear 1 Length 2 Centimeters^2 2 Mass 1 Grams 3 Time -2 Seconds^-2 To give the resolution in e.g. hundredth of joules the "Unit Exponent" item value should have been -9. See also the examples of "Unit" values for some common units in the same chapter. However, there is a common misunderstanding about the "Unit Exponent" value encoding, where it is assumed to be stored the same as nibbles in "Unit" item. This is most likely due to the specification being a bit vague and overloading the term "unit exponent". This also was and still is proliferated by the official "HID Descriptor Tool", which makes this mistake and stores "Unit Exponent" as such. This format is also mentioned in books such as "USB Complete" and in Microsoft's hardware design guides. As a result many devices currently on the market use this encoding and so the driver should support them. Signed-off-by: NNikolai Kondrashov <spbnick@gmail.com> Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 13 9月, 2013 1 次提交
-
-
由 Benjamin Tissoires 提交于
When dealing with usage_index, be sure to properly use unsigned instead of int to avoid overflows. When working on report fields, always validate that their report_counts are in bounds. Without this, a HID device could report a malicious feature report that could trick the driver into a heap overflow: [ 634.885003] usb 1-1: New USB device found, idVendor=0596, idProduct=0500 ... [ 676.469629] BUG kmalloc-192 (Tainted: G W ): Redzone overwritten CVE-2013-2897 Cc: stable@vger.kernel.org Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: NKees Cook <keescook@chromium.org> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 02 9月, 2013 1 次提交
-
-
由 Jiri Kosina 提交于
Instead of using data from stack for DMA in hidinput_get_battery_property(), allocate the buffer dynamically. Cc: stable@kernel.org Reported-by: NRichard Ryniker <ryniker@alum.mit.edu> Reported-by: NAlan Stern <stern@rowland.harvard.edu> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 31 7月, 2013 1 次提交
-
-
由 David Herrmann 提交于
The hidinput_input_event() callback converts input events written from userspace into HID reports and sends them to the device. We currently implement this in every HID transport driver, even though most of them do the same. This provides a generic hidinput_input_event() implementation which is mostly copied from usbhid. It uses a delayed worker to allow multiple LED events to be collected into a single output event. We use the custom ->request() transport driver callback to allow drivers to adjust the outgoing report and handle the request asynchronously. If no custom ->request() callback is available, we fall back to the generic raw output report handler (which is synchronous). Drivers can still provide custom hidinput_input_event() handlers (see logitech-dj) if the generic implementation doesn't fit their needs. Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 20 6月, 2013 2 次提交
-
-
由 Jiri Kosina 提交于
Extend the comment explaining the condition for discarding out-of-range values to clarify the cases in which devices don't provide any logical min/max. Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
由 Benjamin Tissoires 提交于
Commit 6da70669 introduced in 3.3 "HID: ignore absolute values which don't fit between logical min and max" prevents some Posiflex touch screen to work because they do not provide logical min and max for their buttons. Thus, logical min and max are at 0, discarding the buttons events, and preventing the device to report appropriate X Y. Adding a check on "min < max" solves the problem. Reported-by: NJan Kandziora <jjj@gmx.de> Tested-by: NJan Kandziora <jjj@gmx.de> Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 29 5月, 2013 1 次提交
-
-
由 David Herrmann 提交于
power_supply core has the bad habit of calling our battery callbacks from within power_supply_register(). Furthermore, if the callbacks fail with an unhandled error code, it will skip any uevent that it might currently process. So if HID-core registers battery devices, an "add" uevent is generated and the battery callbacks are called. These will gracefully fail due to timeouts as they might still hold locks on event processing. One could argue that this should be fixed in power_supply core, but the least we can do is to signal ENODATA so power_supply core will just skip the property and continue with the uevent. This fixes a bug where "add" and "remove" uevents are skipped for battery devices. upower is unable to track these devices and currently needs to ignore them. This patch also overwrites any other error code. I cannot see any reason why we should forward protocol- or I/O-errors to the power_supply core. We handle these errors in hid_ll_driver later, anyway, so just skip them. power_supply core cannot do anything useful with them, anyway, and we avoid skipping important uevents and confusing user-space. Thanks a lot to Daniel Nicoletti for pushing and investigating on this. Cc: Jiri Kosina <jkosina@suse.cz> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Reported-by: NDaniel Nicoletti <dantti12@gmail.com> Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 27 3月, 2013 1 次提交
-
-
由 Benjamin Tissoires 提交于
There is no need to register an input device containing no events. This allows drivers using the quirk MULTI_INPUT to register one input per report effectively used. For backward compatibility, we need to add a quirk to request this behavior. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 29 11月, 2012 1 次提交
-
-
由 Benjamin Tissoires 提交于
This just refactors the allocation of hid_input. No semantic changes. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: NHenrik Rydberg <rydberg@euromail.se> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 26 11月, 2012 1 次提交
-
-
由 Ortwin Glück 提交于
Support battery capacity on another Apple wireless keyboard. Signed-off-by: NOrtwin Glück <odi@odi.ch> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 15 11月, 2012 3 次提交
-
-
由 Benjamin Tissoires 提交于
HID spec details special values for the HID field unit exponent. Basically, the range [0x8..0xf] correspond to [-8..-1], so this is a standard two's complement on a half-byte. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: NJiri Kosina <jkosina@suse.cz> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
由 Benjamin Tissoires 提交于
hidinput_calc_abs_res should return the closest int in the division instead of the floor. On a device with a logical_max of 3008 and a physical_max of 255mm, previous implementation gave a resolution of 11 instead of 12. With 11, user-space computes a physical size of 273.5mm and the round_closest results gives 250.6mm. The old implementation introduced an error of 2cm in this example. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: NJiri Kosina <jkosina@suse.cz> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
由 Benjamin Tissoires 提交于
Exporting the function allows us to calculate the resolution in third party drivers like hid-multitouch. This patch also complete the function with additional valid axes. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: NJiri Kosina <jkosina@suse.cz> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 31 10月, 2012 1 次提交
-
-
由 Ingo Ruhnke 提交于
Button names for USB gamepads are currently assigned incorrectly, as the evdev code assigned to buttons is "BTN_GAMEPAD + code", which on devices with more then 16 buttons bleeds over into button names reserved for graphic tablets (BTN_TOOL_PEN, etc.). This causes problems further down the line as the device are now no longer detected as joystick. This patch fixes that by assigning buttons outside the range to BTN_TRIGGER_HAPPY (as is already the case for USB joysticks). Furthermore this patch corrects the assignment to BTN_TRIGGER_HAPPY, as currently the first button over 16 is assigned to BTN_TRIGGER_HAPPY17 (i.e. BTN_TRIGGER_HAPPY+0x10) not BTN_TRIGGER_HAPPY. Signed-off-by: NIngo Ruhnke <grumbel@gmail.com> Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 20 9月, 2012 1 次提交
-
-
由 Henrik Rydberg 提交于
A hid device may create several input devices, and a driver may need to prepare or finalize the configuration per input device. Currently, there is no sane way for a driver to know when a device has been configured. This patch adds a callback providing that information. Reviewed-and-tested-by: NBenjamin Tissoires <benjamin.tissoires@enac.fr> Tested-by: NPing Cheng <pingc@wacom.com> Acked-by: NJiri Kosina <jkosina@suse.cz> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
- 09 7月, 2012 1 次提交
-
-
由 Keng-Yu Lin 提交于
The keys are found on the keyboards bundled with HP All-In-One machines with USB VID/PID of 04ca:004d and 04f2:1061. Signed-off-by: NKeng-Yu Lin <kengyu@canonical.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 04 7月, 2012 1 次提交
-
-
由 Daniel Nicoletti 提交于
Add USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, to the quirk list since it report wrong feature type and wrong percentage range. Signed-off-by: NDaniel Nicoletti <dantti12@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 01 5月, 2012 1 次提交
-
-
由 Henrik Rydberg 提交于
Switch the driver over to device group handling. By adding the HID_GROUP_MULTITOUCH group to hid-core, hid-generic will no longer match multitouch devices. By adding the HID_GROUP_MULTITOUCH entry to the device list, hid-multitouch will match all unknown multitouch devices, and udev will automatically load the module. Since HID_QUIRK_MULTITOUCH never gets set, the special quirks handling can be removed. Since all HID MT devices have HID_DG_CONTACTID, they can be removed from the hid_have_special_driver list. With this patch, the unknown device ids are no longer NULL, so the code is modified to check for the generic entry instead. Signed-off-by: NHenrik Rydberg <rydberg@euromail.se> Acked-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 28 3月, 2012 1 次提交
-
-
由 Nikolai Kondrashov 提交于
Add digitizer X Tilt and Y Tilt usage support along with resolution calculation. Signed-off-by: NNikolai Kondrashov <spbnick@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 05 3月, 2012 1 次提交
-
-
由 Nikolai Kondrashov 提交于
Allow array field values out of range as per HID 1.11 specification, section 6.2.25: Rather than returning a single bit for each button in the group, an array returns an index in each field that corresponds to the pressed button (like keyboard scan codes). An out-of range value in and array field is considered no controls asserted. Apparently, "and" above is a typo and should be "an". This fixes at least Waltop tablet pen clicks - otherwise BTN_TOUCH is never released. The relevant part of Waltop tablet report descriptors is this: 0x09, 0x42, /* Usage (Tip Switch), */ 0x09, 0x44, /* Usage (Barrel Switch), */ 0x09, 0x46, /* Usage (Tablet Pick), */ 0x15, 0x01, /* Logical Minimum (1), */ 0x25, 0x03, /* Logical Maximum (3), */ 0x75, 0x04, /* Report Size (4), */ 0x95, 0x01, /* Report Count (1), */ 0x80, /* Input, */ This is a regression fix for commit b4b583d4 ("HID: be more strict when ignoring out-of-range fields"). Signed-off-by: NNikolai Kondrashov <spbnick@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 04 2月, 2012 1 次提交
-
-
由 Jeremy Fitzhardinge 提交于
Set the battery's power supply scope to "Device" and point the power supply to the powered device. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 08 1月, 2012 8 次提交
-
-
由 Jeremy Fitzhardinge 提交于
Apple keyboards require a FEATURE report to query the battery state, even though they list as an input. Without this, it returns an error. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
hidinput_get_battery_property() now directly polls the device for the current battery strength, so there's no need for battery_val, or the code to set it on the input event path. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
It just isn't a battery which is powering the computer. upower needs a more nuanced understanding of this. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
Some devices seem to report batteries as FEATUREs, others as INPUTs. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
Some devices always report percentage, despite having 0/255 as their min/max, so add a quirk for them. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Jeremy Fitzhardinge 提交于
Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
-
由 Daniel Nicoletti 提交于
I've sent an email earlier asking for help with a GetFeature code, and now I have a second patch on top of Jeremy's to provide the battery functionality for devices that support reporting it. If I understood correctly when talking to Jeremy he said his device never actually reported the status as an input event (sorry if I didn't understand it correctly), and after reading HID specs I believe it's really because it was meant to be probed, I have an Apple Keyboard and Magic Trackpad both bluetooth batteries operated, so using PacketLogger I saw that Mac OSX always ask the battery status using the so called GetFeature. What my patch does is basically: - store the report id that matches the battery_strength - setup the battery if 0x6.0x20 is found, even if that is reported as a feature (as it was meant to be but only the MagicTrackpad does) - when upower or someone access /sys/class/power_supply/hid-*/capacity it will probe the device and return it's status. It works great for both devices, but I have two concerns: - the report_features function has a duplicated code - it would be nice if it was possible for specific drivers to provide their own probe as there might be some strange devices... (but maybe it's already possible) I've talked to the upower dev and he fixed it to be able to show the right percentage. Here how the uevent file (in /sys/class/power_supply/hid-*/) looks like: POWER_SUPPLY_NAME=hid-00:22:41:D9:18:E7-battery POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_ONLINE=1 POWER_SUPPLY_CAPACITY=66 POWER_SUPPLY_MODEL_NAME=MacAdmin’s keyboard POWER_SUPPLY_STATUS=Discharging POWER_SUPPLY_NAME=hid-70:CD:60:F5:FF:3F-battery POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_ONLINE=1 POWER_SUPPLY_CAPACITY=62 POWER_SUPPLY_MODEL_NAME=nexx’s Trackpad POWER_SUPPLY_STATUS=Discharging Signed-off-by: NDaniel Nicoletti <dantti12@gmail.com>
-
- 21 12月, 2011 1 次提交
-
-
由 Daniel Kurtz 提交于
Defer LED setting action to a workqueue. This is more likely to send all LED change events in a single URB. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Acked-by: NOliver Neukum <oneukum@suse.de> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 30 11月, 2011 1 次提交
-
-
由 Jeremy Fitzhardinge 提交于
As reported by Stephen Rothwell: drivers/hid/hid-input.c: In function 'hidinput_hid_event': drivers/hid/hid-input.c:865:6: error: 'struct hid_device' has no member named 'battery_val' drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member named 'battery_min' drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member named 'battery_max' Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org> Reported-by: NStephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 28 11月, 2011 1 次提交
-
-
由 Jeremy Fitzhardinge 提交于
Some HID devices, such as my Bluetooth mouse, report their battery strength as an event. Rather than passing it through as a strange absolute input event, this patch registers it with the power_supply subsystem as a battery, so that the device's Battery Strength can be reported to usermode. The battery appears in sysfs names /sys/class/power_supply/hid-<UNIQ>-battery, and it is a child of the battery-containing device, so it should be clear what it's the battery of. Unfortunately on my current Fedora 16 system, while the battery does appear in the UI, it is listed as a Laptop Battery with 0% charge (since it ignores the "capacity" property of the battery and instead computes it from the "energy*" fields, which we can't supply given the limited information contained within the HID Report). Still, this patch is the first step. Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 16 11月, 2011 2 次提交
-
-
由 Jiri Kosina 提交于
HID 1.11 specification, section 5.10 tells us: HID class devices support the ability to ignore selected fields in a report at run- time. This is accomplished by declaring bit field in a report that is capable of containing a range of values larger than those actually generated by the control. If the host or the device receives an out-of-range value then the current value for the respective control will not be modified. So we shouldn't be restricted to EV_ABS only. Reported-by: NDenilson Figueiredo de Sá <denilsonsa@gmail.com> Tested-by: NDenilson Figueiredo de Sá <denilsonsa@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
由 Jiri Kosina 提交于
Linux should ignore values outside logical min/max range, as they are not meaningful. This is what at least some of other OSes do, and it also makes sense (currently the value gets misinterpreted larger up the stack). Reported-by: NDenilson Figueiredo de Sá <denilsonsa@gmail.com> Tested-by: NDenilson Figueiredo de Sá <denilsonsa@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 26 9月, 2011 1 次提交
-
-
由 Benjamin Tissoires 提交于
As mentioned by http://www.microsoft.com/whdc/device/input/DigitizerDrvs_touch.mspx multitouch devices are those that have the input report HID_CONTACTID. This patch detects this and unloads the generic-usb driver. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@enac.fr> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 18 5月, 2011 1 次提交
-
-
由 Jarod Wilson 提交于
I've got a Tivo Slide bluetooth remote/dongle, which uses a fair number of hid usages that aren't currently mapped in hid-input.c. I'd initially written additions to hid-input.c with just this device in mind, including some bits that were specific to the device. This go around, I'm looking at adding/correcting as many generic HID usages from the HID Usage Tables, version 1.12, as I can -- which also serves to enable all but four of the buttons on the Tivo Slide remote[*]. Outside of fixing the obviously incorrect mapping of 0xc 0x45 from KEY_RADIO to KEY_RIGHT, and making use of the new KEY_IMAGES (just added in 2.6.39-rc4) for AL Image Browser instead of KEY_MEDIA, these are purely additions, and thus should have no negative impact on any already functional HID devices. Most of the added mappings seemed to be perfectly logical to me, but there were a few that were mapped on more of an "I think this makes the most sense" basis. [*] I'll handle the last four tivo buttons via an hid-tivo.c follow-up. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: Jiri Kosina <jkosina@suse.cz> Signed-off-by: NJarod Wilson <jarod@redhat.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 02 3月, 2011 1 次提交
-
-
由 Henrik Rydberg 提交于
When the multi input quirk is set, there is a new input device created for every feature report. Since the idea is to present features per hid device, not per input device, revert back to the original report loop and change the feature_mapping() callback to not take the input device as argument. Signed-off-by: NHenrik Rydberg <rydberg@euromail.se> Tested-by: NBenjamin Tissoires <benjmain.tissoires@gmail.com> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 16 2月, 2011 1 次提交
-
-
由 Benjamin Tissoires 提交于
Goto out_cleanup infers a kernel oops: hidinput_disconnect calls input_unregister_driver to all members of hid->inputs. However, hidinput already has been added to hid->inputs even though input_register_device was not called. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@enac.fr> Reviewed-by: NDmitry Torokhov <dtor@mail.ru> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-
- 01 2月, 2011 1 次提交
-
-
由 Dmitry Torokhov 提交于
All users of old style get/setkeycode methids have been converted so it is time to retire them. Acked-by: NMauro Carvalho Chehab <mchehab@redhat.com> Acked-by: NJiri Kosina <jkosina@suse.cz> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 12 1月, 2011 1 次提交
-
-
由 Benjamin Tissoires 提交于
Currently hid doesn't export the features it knows to the specific modules. Some information can be really important in such features: MosArt and Cypress devices are by default not in a multitouch mode. We have to send the value 2 on the right feature. This patch exports to the module the features report so they can find the right feature to set up the correct mode. Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@enac.fr> Acked-by: NHenrik Rydberg <rydberg@euromail.se> Signed-off-by: NJiri Kosina <jkosina@suse.cz>
-