-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSBaccessBasic.h
More file actions
executable file
·92 lines (81 loc) · 3.55 KB
/
USBaccessBasic.h
File metadata and controls
executable file
·92 lines (81 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* USBaccessBasic.h
*
* Basic class definitions for access to USB HID devices
*
* Copyright (C) 2018, Intel - http://www.intel.com/
*
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* Contributors:
* - From http://www.cleware.info/data/linux_E.html
* - Pengfei, Xu <pengfei.xu@intel.com>
* - Add print and format normalize
*/
/*****************************************************************************/
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the USBACCESS_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// USBACCESS_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifndef __USBACCESSBASIC_H__
#define __USBACCESSBASIC_H__
#define CLEWARE_DEBUG 1
#define INVALID_HANDLE_VALUE -1
enum USBtype_enum { ILLEGAL_DEVICE=0,
LED_DEVICE=0x01,
POWER_DEVICE=0x02,
WATCHDOG_DEVICE=0x05,
AUTORESET_DEVICE=0x06,
WATCHDOGXP_DEVICE=0x07,
SWITCH1_DEVICE=0x08,
SWITCH2_DEVICE=0x09, SWITCH3_DEVICE=0x0a, SWITCH4_DEVICE=0x0b,
SWITCH5_DEVICE=0x0c, SWITCH6_DEVICE=0x0d, SWITCH7_DEVICE=0x0e, SWITCH8_DEVICE=0x0f,
TEMPERATURE_DEVICE=0x10,
TEMPERATURE2_DEVICE=0x11,
TEMPERATURE5_DEVICE=0x15,
HUMIDITY1_DEVICE=0x20,
SWITCHX_DEVICE=0x28, // new switch 3,4,8
// CONTACT1_DEVICE=0x30
CONTACT00_DEVICE=0x30, CONTACT01_DEVICE=0x31, CONTACT02_DEVICE=0x32, CONTACT03_DEVICE=0x33,
CONTACT04_DEVICE=0x34, CONTACT05_DEVICE=0x35, CONTACT06_DEVICE=0x36, CONTACT07_DEVICE=0x37,
CONTACT08_DEVICE=0x38, CONTACT09_DEVICE=0x39, CONTACT10_DEVICE=0x3a, CONTACT11_DEVICE=0x3b,
CONTACT12_DEVICE=0x3c, CONTACT13_DEVICE=0x3d, CONTACT14_DEVICE=0x3e, CONTACT15_DEVICE=0x3f,
F4_DEVICE=0x40,
KEYC01_DEVICE=0x41, KEYC16_DEVICE=0x42,
ADC0800_DEVICE=0x50, ADC0801_DEVICE=0x51, ADC0802_DEVICE=0x52, ADC0803_DEVICE=0x53,
COUNTER00_DEVICE=0x60,
ENCODER01_DEVICE=0x80,
BUTTON_NODEVICE=0x1000
};
// 03.11.02 ws small changes for Linux
typedef struct {
unsigned long int handle;
int gadgetVersionNo;
enum USBtype_enum gadgettype;
int SerialNumber;
int report_type;
} cwSUSBdata;
void cwInitCleware();
int cwOpenCleware(); // returns number of found Cleware devices
void cwCloseCleware();
int cwGetValue(int deviceNo, int UsagePage, int Usage, unsigned char *buf, int bufsize);
int cwSetValue(int deviceNo, int UsagePage, int Usage, unsigned char *buf, int bufsize);
unsigned long int cwGetHandle(int deviceNo);
int cwGetVersion(int deviceNo);
enum USBtype_enum cwGetUSBType(int deviceNo);
int cwGetSerialNumber(int deviceNo);
int cwRecover(int devNum); // try to find disconnected devices
int cwValidSerNum(int SerialNumber, enum USBtype_enum devType);
void cwDebugWrite(char const *s);
void cwDebugClose();
#endif // __USBACCESS_H__