apcupsd-ups: ignore generated files
[networkupstools/kirr.git] / drivers / explore-hid.c
blob40154e16eb523920bc0ef8ef194ab08005d18de6
1 /* explore-hid.c - this is a "stub" subdriver used to collect data
2 * about HID UPS systems that are not yet supported.
4 * This subdriver will match any UPS, but only if the "-x explore" option
5 * is given.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "main.h"
25 #include "usbhid-ups.h"
26 #include "explore-hid.h"
28 #define EXPLORE_HID_VERSION "EXPLORE HID 0.1"
30 static usage_tables_t explore_utab[] = {
31 hid_usage_lkp,
32 NULL,
35 /* --------------------------------------------------------------- */
36 /* Data lookup table (HID <-> NUT) */
37 /* --------------------------------------------------------------- */
39 static hid_info_t explore_hid2nut[] =
41 /* end of structure. */
42 { NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
45 static const char *explore_format_model(HIDDevice_t *hd) {
46 return hd->Product;
49 static const char *explore_format_mfr(HIDDevice_t *hd) {
50 return hd->Vendor;
53 static const char *explore_format_serial(HIDDevice_t *hd) {
54 return hd->Serial;
57 /* this function allows the subdriver to "claim" a device: return 1 if
58 * the device is supported by this subdriver, else 0. */
59 static int explore_claim(HIDDevice_t *hd) {
60 if (testvar("explore")) {
61 return 1;
62 } else {
63 return 0;
67 subdriver_t explore_subdriver = {
68 EXPLORE_HID_VERSION,
69 explore_claim,
70 explore_utab,
71 explore_hid2nut,
72 explore_format_model,
73 explore_format_mfr,
74 explore_format_serial,