-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
35 lines (25 loc) · 720 Bytes
/
Copy pathmain.c
File metadata and controls
35 lines (25 loc) · 720 Bytes
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
#include "hidapi.h"
#define VENDOR_ID 0x054c
#define DUALSENSE_PRODUCT_ID 0x0ce6
#define DUALSENSE_EDGE_PRODUCT_ID 0x0df2
hid_device* OpenDevice(void){
hid_device *device = hid_open(VENDOR_ID, DUALSENSE_PRODUCT_ID, NULL);
if (!device){
device = hid_open(VENDOR_ID, DUALSENSE_EDGE_PRODUCT_ID, NULL);
}
return device;
}
void SendSleepReport(hid_device *const device){
unsigned char report[48] = {0};
report[0] = 0x02;
report[1] = 0x0C;
report[2] = 0x0A;
hid_write(device, report, sizeof(report));
}
int main(void){
hid_device *const device = OpenDevice();
if (!device) return -1;
SendSleepReport(device);
hid_close(device);
return 0;
}