This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 135
/
SoftU2FDevice.hpp
50 lines (43 loc) · 1.81 KB
/
SoftU2FDevice.hpp
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
//
// SoftU2FDevice.hpp
// SoftU2F
//
// Created by Benjamin P Toews on 1/12/17.
//
#ifndef SoftU2FDevice_hpp
#define SoftU2FDevice_hpp
#include <IOKit/hid/IOHIDDevice.h>
unsigned char const u2fhid_report_descriptor[] = {
0x06, 0xD0, 0xF1, // Usage Page (Reserved 0xF1D0)
0x09, 0x01, // Usage (0x01)
0xA1, 0x01, // Collection (Application)
0x09, 0x20, // Usage (0x20)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8)
0x95, 0x40, // Report Count (64)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null
// Position)
0x09, 0x21, // Usage (0x21)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8)
0x95, 0x40, // Report Count (64)
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null
// Position,Non-volatile)
0xC0, // End Collection
};
class SoftU2FDevice : public IOHIDDevice {
OSDeclareDefaultStructors(SoftU2FDevice)
public:
static SoftU2FDevice* newDevice();
virtual OSString *newProductString() const override;
virtual OSString *newSerialNumberString() const override;
virtual OSNumber *newVendorIDNumber() const override;
virtual OSNumber *newProductIDNumber() const override;
virtual OSNumber *newPrimaryUsagePageNumber() const override;
virtual OSNumber *newPrimaryUsageNumber() const override;
virtual IOReturn newReportDescriptor(IOMemoryDescriptor **descriptor) const override;
virtual IOReturn setReport(IOMemoryDescriptor *report, IOHIDReportType reportType, IOOptionBits options = 0) override;
};
#endif /* SoftU2FDevice_hpp */