Python Forum
Change HID bytes using pywinusb.hid - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Change HID bytes using pywinusb.hid (/thread-40301.html)



Change HID bytes using pywinusb.hid - Stealthrt - Jul-06-2023

Hey all I am new to the Python world and need some help.

I have an HID device that I am needing to replace 0x00 with 0x01 and I have this example code to modify in order to do that (I think):
import pywinusb.hid as hid

def readData(data):

print(data)
device = hid.HidDeviceFilter(vendor_id=0x5140).get_devices()[0]

if not device:
   print ("No device found")
else:
   print(device)
   device.open()
   report = device.find_output_reports()
   buffer = b'\x00\x00\x00\x00\x00'
   report[0].set_raw_data(buffer)
   report[0].send()

device.set_raw_data_handler(readData)
device.close()
So would I replace the b'\x00\x00\x00\x00\x00' with b'\x00\x01' in order to change it in the HID device?