Giter Club home page Giter Club logo

Comments (8)

rene-aguirre avatar rene-aguirre commented on June 24, 2024

Hello @tanyanghan , could you run your binary in an Administrator shell?

I think the OS might be protecting the USB access to an un-trusted executable.

If this works on a admin console, either you'd need to change the binary properties manually, or you might need to add some sort of trusted certificate (check pyinstaller docs).

from pywinusb.

tanyanghan avatar tanyanghan commented on June 24, 2024

Hi @rene-aguirre, thanks for your response. I have tried running it as under an admin console, but it didn't make a difference. I also tried right clicking on the exe in Explorer and running the exe from Explorer as admin but it still didn't work.

from pywinusb.

tanyanghan avatar tanyanghan commented on June 24, 2024

I've signed the exe with a self-signed certificate which I added to the Trusted Root Certification Authority on my PC, but the result is still the same with the vID and pID all returning as zeroes. The signing appears to have worked because the properties of the exe in Explorer now shows This digital signature is OK.

from pywinusb.

tanyanghan avatar tanyanghan commented on June 24, 2024

Further digging, winapi.CreateFile() appears to be returning a valid h_hid handle and calling ctypes.GetLastError() returns 0 - ERROR_SUCCESS.

BUT when it tries to read the attributes hid_dll.HidD_GetAttributes(h_hid, byref(hidd_attributes)), it fails and ctypes.GetLastError() returns 6 - ERROR_INVALID_HANDLE.

from pywinusb.

rene-aguirre avatar rene-aguirre commented on June 24, 2024

@tanyanghan Could be an issue with your registry? Example: http://digital.ni.com/public.nsf/allkb/1D52B53149DD637686256CAA00565E47

from pywinusb.

tanyanghan avatar tanyanghan commented on June 24, 2024

I tried it, and it didn't seem to have made a difference.

from pywinusb.

tanyanghan avatar tanyanghan commented on June 24, 2024

Here's the problem. I was using Python x86-64 and it didn't work after pyinstaller packaged it up.
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32

It works with Python x86 (32-bit) after pyinstaller packages it up!
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32

from pywinusb.

rene-aguirre avatar rene-aguirre commented on June 24, 2024

Thanks for let us know @tanyanghan !

from pywinusb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.