Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add examples #6

Open
wadester opened this issue Nov 6, 2015 · 3 comments
Open

Please add examples #6

wadester opened this issue Nov 6, 2015 · 3 comments

Comments

@wadester
Copy link

wadester commented Nov 6, 2015

If you like my example, please add an examples dir and the example Python script.

https://github.com/wadester/wh_test_py/blob/master/hid_test.py

@pktiuk
Copy link

pktiuk commented Feb 15, 2020

Thank for examples, I really needed them.
I agree that is should be added to repo.

@CurtisPreston99
Copy link

if anyone has an example of how to use the write function would be great I'm having issues getting the types right this is what i have tryied and it seams right from what

a = ctypes.c_void_p(0)
b = ctypes.c_char_p(10)
c = ctypes.c_size_t(1)
h.write((a,b,c))
    a = ctypes.c_void_p(0)
    b = ctypes.c_char_p(10)
    c = ctypes.c_size_t(1)
    h.write([a,b,c])
    h.write((0x0,0x0,0x1))

and I'm not too sure what else to try any advice would be welcomed

@danio
Copy link

danio commented Sep 23, 2022

This is how I got write working:

dev = hid.Device(vid, pid) # set vid and pid for your device
dev.write(b'\x01\x80\x33\x01\x00\x00\x00\x00') # writing 8 bytes to the device 
bytes = dev.read(8, 1000) # reading 8 bytes from the device with a 1s timeout
bytes.hex(' ') # format the result in a human readable format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants