Python win32file 模块 DeviceIoControl 参数不正确

发布于 2024-12-29 08:56:32 字数 515 浏览 4 评论 0原文

我有一台联想 ThinkPad 笔记本电脑,内置加速计,称为主动保护系统。我的操作系统是Windows 7,安装了python 2.7。我正在尝试编译一个 python 脚本,该脚本假设从加速度计读取数据,但它给出了错误:(87,'DeviceIoControl','参数不正确。') 错误。

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 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文