-
Notifications
You must be signed in to change notification settings - Fork 4
/
mac-cel.c
39 lines (34 loc) · 978 Bytes
/
mac-cel.c
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
#include <IOKit/hidsystem/event_status_driver.h>
int main(int argc, char *argv[]) {
CFStringRef device;
const int32_t accel_amount = INT32_MIN;
NXEventHandle handle;
kern_return_t set_accel;
if (argc > 1 && (!(strncmp(argv[1], "-t", 2))))
device = CFSTR(kIOHIDTrackpadAccelerationType);
else
device = CFSTR(kIOHIDMouseAccelerationType);
handle = NXOpenEventStatus();
if (!handle) {
perror("NXOpenEventStatus");
return EXIT_FAILURE;
}
set_accel = IOHIDSetParameter(
handle,
device,
&accel_amount,
sizeof(accel_amount)
);
if (set_accel != KERN_SUCCESS) {
perror("IOHIDSetParameter");
NXCloseEventStatus(handle);
return EXIT_FAILURE;
}
NXCloseEventStatus(handle);
return EXIT_SUCCESS;
}