Hallo!
Erstmal vielen Dank für die gründliche Vorarbeit! Ich habe eine Frage, denke das Problem liegt aber nicht im Code sondern sitzt vor dem Computer. Falls das hier nichts zu suchen hat bitte korrigieren.
Ich versuche mit dem angehängten Code die Daten der dnt Station auszulesen. Die Antwort ist immer leer. Wenn man der Korrespondenz des Geräts mit der EasyTemp-Software zuhört schickt es allerdings (sinnvolle) Daten.
Mache ich etwas offensichtliches falsch? Muss phython spezielle Rechte bez. des Serial Ports haben? Ist das Timing von Anfragen und Zuhören einfach falsch?
Benutze Windows 10, Python 3.8, Station ist neu gekauft
Vielen Dank und liebe Grüße!
Code:
-- coding: utf-8 --
"""
Created on Mon Feb 20 17:32:57 2023
"""
from future import print_function
import hid
import time
for d in hid.enumerate():
keys = list(d.keys())
keys.sort()
for key in keys:
print("%s : %s" % (key, d[key]))
print()
try:
print("Opening the device")
h = hid.device()
h.open(0x0483, 0x5750) # AENDERUNG: Vendor-ID und Product-ID aus der dmesg Meldung
print("Manufacturer: %s" % h.get_manufacturer_string())
print("Product: %s" % h.get_product_string())
print("Serial No: %s" % h.get_serial_number_string())
h.set_nonblocking(1)
print("Write the data")
h.write([0x7b, 0x03, 0x40, 0x7d] + [0x00] * 60) # AENDERUNG: Unsere Anfrage 0x03
time.sleep(0.75)
# read back the answer
print("Read the data")
while True:
d = h.read(64)
if d:
print(d)
else:
break
print("Closing the device")
h.close()
except IOError as ex:
print(ex)
print("You probably don't have the hard coded device. Update the hid.device line")
print("in this script with one from the enumeration list output above and try again.")
Hallo! Erstmal vielen Dank für die gründliche Vorarbeit! Ich habe eine Frage, denke das Problem liegt aber nicht im Code sondern sitzt vor dem Computer. Falls das hier nichts zu suchen hat bitte korrigieren.
Ich versuche mit dem angehängten Code die Daten der dnt Station auszulesen. Die Antwort ist immer leer. Wenn man der Korrespondenz des Geräts mit der EasyTemp-Software zuhört schickt es allerdings (sinnvolle) Daten. Mache ich etwas offensichtliches falsch? Muss phython spezielle Rechte bez. des Serial Ports haben? Ist das Timing von Anfragen und Zuhören einfach falsch? Benutze Windows 10, Python 3.8, Station ist neu gekauft
Vielen Dank und liebe Grüße!
Code:
-- coding: utf-8 --
""" Created on Mon Feb 20 17:32:57 2023 """
from future import print_function
import hid import time
for d in hid.enumerate(): keys = list(d.keys()) keys.sort() for key in keys: print("%s : %s" % (key, d[key])) print()
try: print("Opening the device")
except IOError as ex: print(ex) print("You probably don't have the hard coded device. Update the hid.device line") print("in this script with one from the enumeration list output above and try again.")
print("Done")
Antwort:
interface_number : -1 manufacturer_string : MyUSB_HID path : b'\\?\HID#VID_0483&PID_5750#6&7981497&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}' product_id : 22352 product_string : By viewtool release_number : 512 serial_number : 787976C10832 usage : 1 usage_page : 140 vendor_id : 1155
interface_number : 0 manufacturer_string : Hewlett-Packard Company path : b'\\?\HID#VID_03F0&PID_1024&MI_00#7&8f03712&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd' product_id : 4132 product_string : HP USB Smart Card Keyboard release_number : 1333 serial_number : 0816a4cb usage : 6 usage_page : 1 vendor_id : 1008
interface_number : -1 manufacturer_string : Microsoft path : b'\\?\HID#VID_045E&PID_0040#6&991de3e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}' product_id : 64 product_string : Microsoft 3-Button Mouse with IntelliEye(TM) release_number : 768 serial_number : usage : 2 usage_page : 1 vendor_id : 1118
Opening the device Manufacturer: MyUSB_HID Product: By viewtool Serial No: 787976C10832 Write the data Read the data Closing the device Done