python - 在 Windows 上使用 Python 通过 USB 读取 iOS 设备生成和型号

标签 python ios usb communication detection

您好,我有一个 GUI,我想通过台式计算机上的 USB 连接检测 iPod touch 和 iPhone 的代号和型号。我看过 libgpod,但我使用的是 Windows 机器,对如何安装它知之甚少(如果它甚至与 Windows 兼容的话)

我希望我可以连接到设备,找到并打印生成(类似于 iPod 1,1 - iPod touch 1G),然后指定要下载的与设备相关的文件。

最佳答案

好吧,我想通过代码示例为您提供更好的答案,但这应该让您入门。

pywinusb是您最好的选择,因为它可以更可靠地读取有关插入设备的更多信息。有一些输出连接设备等的好例子,here是一些很好的例子。您需要查找 vendor_id 或查找 product_id 以供您使用,下面是一些示例代码。

from pywinusb import hid

# filter connected devices by vendor and product
filter = hid.HidDeviceFilter(vendor_id = 0x0777, product_id = 0x0077)

# filter connected devices by vendor
# filter = hid.HidDeviceFilter(vendor_id = 0x0777)

# filter connected devices by product
# filter = hid.HidDeviceFilter(product_id = 0x0077)

devices = filter.get_devices()

for device in devices:
    print device

您可以找到更多 examples here .

可能尝试使用 win32com 从 WMI 列出 Win32_USBHub 设备??

import win32com.client

wmi = win32com.client.GetObject ("winmgmts:")
for usb in wmi.InstancesOf ("Win32_USBHub"):
    print "DeviceID - " + usb.DeviceID
    print "Name - " + usb.Name
    print "Description - " + usb.Description
    print "Caption - " + usb.Caption
    print "SystemName - " + usb.SystemName
    print "PNPDeviceID - " + usb.PNPDeviceID
    print "\n\n"

关于python - 在 Windows 上使用 Python 通过 USB 读取 iOS 设备生成和型号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24819928/

相关文章:

ios - 有什么我不应该保存在 NSUserDefaults 中的吗

embedded - 用于 STM32 微 Controller 的 UART over USB

Python Turtle 碰撞帮助和更新分数/生命

python - 使用 pytest 检查是否有任何测试引发弃用警告

python - HTTP Negotiate windows vs. Unix 服务器实现使用 python-kerberos

ios - 从 xcode 获取 json

python - 如何从某篇文章中获取完整的维基百科修订历史列表?

ios - 动画期间的帧值错误

linux - 为什么我有多个产品和供应商 ID?

windows - WinUSB 在非开发计算机上失败