Windows 11 Wie lese ich Daten von einem USB -Gerät>Python

Python-Programme
Anonymous
 Windows 11 Wie lese ich Daten von einem USB -Gerät>

Post by Anonymous »

Ich habe versucht, Daten von einem Temperkern -USB -Temperatur- und Feuchtigkeitsgerät zu lesen.
Ich kann das Gerät aus Linux lesen.

Code: Select all

import wmi

try:
c = wmi.WMI()
print("Connected USB Devices:")
count = 0
for usb in c.Win32_USBControllerDevice():
dependent_device = usb.Dependent
if dependent_device:
# Extract relevant information from the dependent device object
# The 'Dependent' property refers to the connected USB device
print(f"  Device ID: {dependent_device.DeviceID}")
print(f"  Description: {dependent_device.Description}")
if '10C4' in  dependent_device.DeviceID:
print('Found UART Bridge')
if '3553' in  dependent_device.DeviceID:
print('Found TEMPerHUM')
print("-" * 20)
count += 1
except Exception as e:
print(f"An error occurred: {e}")

print(dir(usb.Dependent))
print(f'Found {count} devices.')
x = input('Press enter to continue: ')
Hat jemand ein Beispiel für das Lesen eines USB -Geräts?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post