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

Possibly remove dependence on Zadig installer on Windows #12

Open
nanoparticle opened this issue Jul 31, 2023 · 0 comments
Open

Possibly remove dependence on Zadig installer on Windows #12

nanoparticle opened this issue Jul 31, 2023 · 0 comments

Comments

@nanoparticle
Copy link

Hi, I just found your project, and it looks pretty cool so I thought I'd give a couple of suggestions:

  • It looks like there is a python package that contains compiled libusb binaries for major operating systems, and I have tested it to work out of the box on windows 10 with no separate installation needed. One caveat is that it seemed to require pyusb to be installed before it would enumerate all my usb devices, but it looks like you are using that already so likely not a problem.
  • I would highly recommend using some sort of virtual environment system for python, as this really helps with dependency management and version control, for making sure each user that installs your software has the same intended behavior. My preferred choice is poetry, but there are several options, none of which I could confidently say is the best.
  • Here is a custom enum definition that encapsulates the length field within DeviceInfoType:
class DeviceInfoType(enum.IntEnum):
    def __new__(cls, value: int, length: int):
        obj = int.__new__(cls, value)
        obj._value_ = value
        return obj
    
    def __init__(self, value: int, length: int):
        self.length = length
    
    DEV_INFO_CHIP_ID = (0, 8)
    DEV_INFO_FW_COMPILE_DATE = (1, 8)
    DEV_INFO_DEV_QUALIFICATION = (2, 8)
    DEV_INFO_IR_INFO = (3, 26)
    DEV_INFO_PROJECT_INFO = (4, 4)
    DEV_INFO_FW_BUILD_VERSION_INFO = (5, 50)
    DEV_INFO_GET_PN = (6, 48)
    DEV_INFO_GET_SN = (7, 16)
    DEV_INFO_GET_SENSOR_ID = (8, 4)

You can still use the enum member as before to retrieve the index as an int, but now if you call DeviceInfoType.DEV_INFO_GET_PN.length, it will retrieve the length instead.

Hope this helps!

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

1 participant