Skip to content

Commit 1ad0bc7

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - syzbot memory corruption fixes for hidraw, Prodikeys, Logitech and Sony drivers from Alan Stern and Roderick Colenbrander - stuck 'fn' key fix for hid-apple from Joao Moreno - proper propagation of EPOLLOUT from hiddev and hidraw, from Fabian Henneke - fixes for handling power management for intel-ish devices with NO_D3 flag set, from Zhang Lixu - extension of supported usage range for customer page, as some Logitech devices are actually making use of it. From Olivier Gay. - hid-multitouch is no longer filtering mice node creation, from Benjamin Tissoires - MobileStudio Pro 13 support, from Ping Cheng - a few other device ID additions and assorted smaller fixes * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (27 commits) HID: core: fix dmesg flooding if report field larger than 32bit HID: core: Add printk_once variants to hid_warn() etc HID: core: reformat and reduce hid_printk macros HID: prodikeys: Fix general protection fault during probe HID: wacom: add new MobileStudio Pro 13 support HID: sony: Fix memory corruption issue on cleanup. HID: i2c-hid: modify quirks for weida's devices HID: apple: Fix stuck function keys when using FN HID: sb0540: add support for Creative SB0540 IR receivers HID: Add quirk for HP X500 PIXART OEM mouse HID: logitech-dj: Fix crash when initial logi_dj_recv_query_paired_devices fails hid-logitech-dj: add the new Lightspeed receiver HID: logitech-dj: add support of the G700(s) receiver HID: multitouch: add support for the Smart Tech panel HID: multitouch: do not filter mice nodes HID: do not call hid_set_drvdata(hdev, NULL) in drivers HID: wacom: do not call hid_set_drvdata(hdev, NULL) HID: logitech: Fix general protection fault caused by Logitech driver HID: hidraw: Fix invalid read in hidraw_ioctl HID: wacom: support named keys on older devices ...
2 parents 1b5fb41 + 8ca06d6 commit 1ad0bc7

28 files changed

+561
-151
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,6 +4338,12 @@ S: Maintained
43384338
F: Documentation/filesystems/cramfs.txt
43394339
F: fs/cramfs/
43404340

4341+
CREATIVE SB0540
4342+
M: Bastien Nocera <[email protected]>
4343+
4344+
S: Maintained
4345+
F: drivers/hid/hid-creative-sb0540.c
4346+
43414347
CRYPTO API
43424348
M: Herbert Xu <[email protected]>
43434349
M: "David S. Miller" <[email protected]>

drivers/hid/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,15 @@ config HID_CP2112
273273
and gpiochip to expose these functions of the CP2112. The
274274
customizable USB descriptor fields are exposed as sysfs attributes.
275275

276+
config HID_CREATIVE_SB0540
277+
tristate "Creative SB0540 infrared receiver"
278+
depends on USB_HID
279+
help
280+
Support for Creative infrared SB0540-compatible remote controls, such
281+
as the RM-1500 and RM-1800 remotes.
282+
283+
Say Y here if you want support for Creative SB0540 infrared receiver.
284+
276285
config HID_CYPRESS
277286
tristate "Cypress mouse and barcode readers"
278287
depends on HID

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ obj-$(CONFIG_HID_ALPS) += hid-alps.o
2727
obj-$(CONFIG_HID_ACRUX) += hid-axff.o
2828
obj-$(CONFIG_HID_APPLE) += hid-apple.o
2929
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
30+
obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o
3031
obj-$(CONFIG_HID_ASUS) += hid-asus.o
3132
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
3233
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o

drivers/hid/hid-apple.c

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\")
5454
struct apple_sc {
5555
unsigned long quirks;
5656
unsigned int fn_on;
57-
DECLARE_BITMAP(pressed_fn, KEY_CNT);
5857
DECLARE_BITMAP(pressed_numlock, KEY_CNT);
5958
};
6059

@@ -181,6 +180,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
181180
{
182181
struct apple_sc *asc = hid_get_drvdata(hid);
183182
const struct apple_key_translation *trans, *table;
183+
bool do_translate;
184+
u16 code = 0;
184185

185186
if (usage->code == KEY_FN) {
186187
asc->fn_on = !!value;
@@ -189,8 +190,6 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
189190
}
190191

191192
if (fnmode) {
192-
int do_translate;
193-
194193
if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
195194
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
196195
table = macbookair_fn_keys;
@@ -202,25 +201,33 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
202201
trans = apple_find_translation (table, usage->code);
203202

204203
if (trans) {
205-
if (test_bit(usage->code, asc->pressed_fn))
206-
do_translate = 1;
207-
else if (trans->flags & APPLE_FLAG_FKEY)
208-
do_translate = (fnmode == 2 && asc->fn_on) ||
209-
(fnmode == 1 && !asc->fn_on);
210-
else
211-
do_translate = asc->fn_on;
212-
213-
if (do_translate) {
214-
if (value)
215-
set_bit(usage->code, asc->pressed_fn);
216-
else
217-
clear_bit(usage->code, asc->pressed_fn);
218-
219-
input_event(input, usage->type, trans->to,
220-
value);
221-
222-
return 1;
204+
if (test_bit(trans->from, input->key))
205+
code = trans->from;
206+
else if (test_bit(trans->to, input->key))
207+
code = trans->to;
208+
209+
if (!code) {
210+
if (trans->flags & APPLE_FLAG_FKEY) {
211+
switch (fnmode) {
212+
case 1:
213+
do_translate = !asc->fn_on;
214+
break;
215+
case 2:
216+
do_translate = asc->fn_on;
217+
break;
218+
default:
219+
/* should never happen */
220+
do_translate = false;
221+
}
222+
} else {
223+
do_translate = asc->fn_on;
224+
}
225+
226+
code = do_translate ? trans->to : trans->from;
223227
}
228+
229+
input_event(input, usage->type, code, value);
230+
return 1;
224231
}
225232

226233
if (asc->quirks & APPLE_NUMLOCK_EMULATION &&

drivers/hid/hid-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,8 @@ u32 hid_field_extract(const struct hid_device *hid, u8 *report,
13111311
unsigned offset, unsigned n)
13121312
{
13131313
if (n > 32) {
1314-
hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
1315-
n, current->comm);
1314+
hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1315+
__func__, n, current->comm);
13161316
n = 32;
13171317
}
13181318

drivers/hid/hid-cougar.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int cougar_probe(struct hid_device *hdev,
207207
error = hid_parse(hdev);
208208
if (error) {
209209
hid_err(hdev, "parse failed\n");
210-
goto fail;
210+
return error;
211211
}
212212

213213
if (hdev->collection->usage == COUGAR_VENDOR_USAGE) {
@@ -219,7 +219,7 @@ static int cougar_probe(struct hid_device *hdev,
219219
error = hid_hw_start(hdev, connect_mask);
220220
if (error) {
221221
hid_err(hdev, "hw start failed\n");
222-
goto fail;
222+
return error;
223223
}
224224

225225
error = cougar_bind_shared_data(hdev, cougar);
@@ -249,8 +249,6 @@ static int cougar_probe(struct hid_device *hdev,
249249

250250
fail_stop_and_cleanup:
251251
hid_hw_stop(hdev);
252-
fail:
253-
hid_set_drvdata(hdev, NULL);
254252
return error;
255253
}
256254

0 commit comments

Comments
 (0)