root/drivers/hid/hid-penmount.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. penmount_input_mapping

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3  *  HID driver for PenMount touchscreens
   4  *
   5  *  Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
   6  *
   7  *  based on hid-penmount copyrighted by
   8  *    PenMount Touch Solutions <penmount <at> seed.net.tw>
   9  */
  10 
  11 /*
  12  */
  13 
  14 #include <linux/module.h>
  15 #include <linux/hid.h>
  16 #include "hid-ids.h"
  17 
  18 static int penmount_input_mapping(struct hid_device *hdev,
  19                 struct hid_input *hi, struct hid_field *field,
  20                 struct hid_usage *usage, unsigned long **bit, int *max)
  21 {
  22         if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
  23                 if (((usage->hid - 1) & HID_USAGE) == 0) {
  24                         hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
  25                         return 1;
  26                 } else {
  27                         return -1;
  28                 }
  29         }
  30 
  31         return 0;
  32 }
  33 
  34 static const struct hid_device_id penmount_devices[] = {
  35         { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
  36         { }
  37 };
  38 MODULE_DEVICE_TABLE(hid, penmount_devices);
  39 
  40 static struct hid_driver penmount_driver = {
  41         .name = "hid-penmount",
  42         .id_table = penmount_devices,
  43         .input_mapping = penmount_input_mapping,
  44 };
  45 
  46 module_hid_driver(penmount_driver);
  47 
  48 MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
  49 MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
  50 MODULE_LICENSE("GPL");

/* [<][>][^][v][top][bottom][index][help] */