Yes, it's possible. Here's some rough code to do it:
io_object_t hidSystemParametersConnection = IO_OBJECT_NULL;
// We're looking for a service of the IOHIDSystem class
CFMutableDictionaryRef classesToMatch = IOServiceMatching("IOHIDSystem");
if (!classesToMatch)
/* handle failure */;
// The following call implicitly releases classesToMatch
io_iterator_t matchingServicesIterator = IO_OBJECT_NULL;
IOReturn ret = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, &matchingServicesIterator);
if (ret != kIOReturnSuccess)
/* handle failure */;
io_object_t service;
while ((service = IOIteratorNext(matchingServicesIterator)))
{
// Open the parameters connection to the HIDSystem service
ret = IOServiceOpen(service, mach_task_self(), kIOHIDParamConnectType, &hidSystemParametersConnection);
IOObjectRelease(service);
if (ret == kIOReturnSuccess && hidSystemParametersConnection != IO_OBJECT_NULL)
break;
}
IOObjectRelease(matchingServicesIterator);
CFTypeRef value;
ret = IOHIDCopyCFTypeParameter(hidSystemParametersConnection, CFSTR(kIOHIDPointerAccelerationKey), &value);
if (ret != kIOReturnSuccess || !value)
/* handle failure */;
if (CFGetTypeID(value) != CFNumberGetTypeID())
{
CFRelease(value);
/* handle wrong type */
}
NSNumber* accel = CFBridgingRelease(value);
double newAccel = accel.doubleValue / 2;
ret = IOHIDSetCFTypeParameter(hidSystemParametersConnection, CFSTR(kIOHIDPointerAccelerationKey), (__bridge CFTypeRef)@(newAccel));
if (ret != kIOReturnSuccess)
/* handle failure */;
IOServiceClose(hidSystemParametersConnection);
The various parameter keys are defined and lightly documented in IOKit.framework/Headers/hid/IOHIDProperties.h and IOKit.framework/Headers/hidsystem/IOHIDParameter.h. I would test thoroughly with as much different hardware and configurations in System Preferences as you can, to see exactly which parameters are relevant and what their values mean.