diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:49:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:49:45 +0000 |
commit | 2c3c1048746a4622d8c89a29670120dc8fab93c4 (patch) | |
tree | 848558de17fb3008cdf4d861b01ac7781903ce39 /drivers/hid/hid-jabra.c | |
parent | Initial commit. (diff) | |
download | linux-2c3c1048746a4622d8c89a29670120dc8fab93c4.tar.xz linux-2c3c1048746a4622d8c89a29670120dc8fab93c4.zip |
Adding upstream version 6.1.76.upstream/6.1.76
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/hid/hid-jabra.c')
-rw-r--r-- | drivers/hid/hid-jabra.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/hid/hid-jabra.c b/drivers/hid/hid-jabra.c new file mode 100644 index 000000000..41dc30fe2 --- /dev/null +++ b/drivers/hid/hid-jabra.c @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Jabra USB HID Driver + * + * Copyright (c) 2017 Niels Skou Olsen <nolsen@jabra.com> + */ + +/* + */ + +#include <linux/hid.h> +#include <linux/module.h> + +#include "hid-ids.h" + +#define HID_UP_VENDOR_DEFINED_MIN 0xff000000 +#define HID_UP_VENDOR_DEFINED_MAX 0xffff0000 + +static int jabra_input_mapping(struct hid_device *hdev, + struct hid_input *hi, + struct hid_field *field, + struct hid_usage *usage, + unsigned long **bit, int *max) +{ + int is_vendor_defined = + ((usage->hid & HID_USAGE_PAGE) >= HID_UP_VENDOR_DEFINED_MIN && + (usage->hid & HID_USAGE_PAGE) <= HID_UP_VENDOR_DEFINED_MAX); + + dbg_hid("hid=0x%08x appl=0x%08x coll_idx=0x%02x usage_idx=0x%02x: %s\n", + usage->hid, + field->application, + usage->collection_index, + usage->usage_index, + is_vendor_defined ? "ignored" : "defaulted"); + + /* Ignore vendor defined usages, default map standard usages */ + return is_vendor_defined ? -1 : 0; +} + +static const struct hid_device_id jabra_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, HID_ANY_ID) }, + { } +}; +MODULE_DEVICE_TABLE(hid, jabra_devices); + +static struct hid_driver jabra_driver = { + .name = "jabra", + .id_table = jabra_devices, + .input_mapping = jabra_input_mapping, +}; +module_hid_driver(jabra_driver); + +MODULE_AUTHOR("Niels Skou Olsen <nolsen@jabra.com>"); +MODULE_DESCRIPTION("Jabra USB HID Driver"); +MODULE_LICENSE("GPL"); |