android_kernel_xiaomi_sm8350/drivers/hid/hid-jabra.c
Thomas Gleixner 2874c5fd28 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:32 -07:00

56 lines
1.4 KiB
C

// 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");