Python Forum
Change HID bytes using pywinusb.hid
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change HID bytes using pywinusb.hid
#1
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  replace bytes with other byte or bytes BigOldArt 1 10,651 Feb-02-2019, 11:00 PM
Last Post: snippsat
  general pywinusb help kiyoshi7 2 10,026 Feb-23-2018, 12:04 AM
Last Post: hashbrown190
  Correct way to change bytes in a file? Raptor88 16 26,586 Feb-23-2017, 06:08 PM
Last Post: Raptor88

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020