I have a Lenovo ThinkPad Laptop which has a build in accelerometer called Active Protection System. My operating system is Windows 7 and I have python 2.7 installed. I am trying to compile a python script that suppose to read data from accelerometer but it is giving error: (87, 'DeviceIoControl', 'The parameter is incorrect.')
error.
import win32file
hDevice = win32file.CreateFile(r'//./ShockMgr', GENERIC_READ, FILE_SHARE_READ, None, OPEN_EXISTING, 0, 0)
if hDevice:
data = win32file.DeviceIoControl(hDevice, 0x733FC, '', 0x24, None)
state = struct.unpack('i16h', data)
I couldn't find accelerometer in device manager but I know it is installed properly as other applications can use it but I guess I can't reach it?
What may cause this problem? How can I resolve it? Thanks in advance.