SivyerLab / pyCrafter4500

Python USB controller for the TI LCR4500EVM
https://pycrafter4500.readthedocs.io/en/latest/
GNU General Public License v3.0
16 stars 16 forks source link

windows connection issue. #1

Open lighta opened 6 years ago

lighta commented 6 years ago

Pycrafter suggest to replace the driver to libusb-win32 for connection. Which seem to work fine but doing this break the GUI provided by TI. Why not just using hid python as requirement instead ? hid is crossplatform and it's how the lcr4500 is driven (at least in C)

cf: https://pypi.python.org/pypi/hid https://github.com/rene-aguirre/pywinusb

arrrobase commented 6 years ago

I had tried using the HID interface, but couldn't get it to work. If you are able to get it to work, migrating over to HID so that the GUI still works would be very beneficial.

lighta commented 6 years ago

alright I push a PR for you once it's done. It seem to work with the hid package, altough I have a little trouve with python c_type, as the hid_package doesn't handle well conversion from list to c_array... That a bit annoying but I can push to a separate branch what I've done so far. NB: It will probably be best to have a class. Communication to allow orveride of read/write to the package we want.

arrrobase commented 6 years ago

Sounds great. Thanks for working on this and contributing.

loorenzImr commented 6 years ago

Windows users have problems finding the backend for pyusb. This is a known issue and solved here: https://stackoverflow.com/questions/33972145/pyusb-on-windows-8-1-no-backend-available-how-to-install-libusb

nikhil4595 commented 5 years ago

@lighta

I have also been trying to get a response from the LCR4500 (without libusb driver) using hid, by a simple enterStandby command through i'm getting the following error

capture

Do you happen to have any solution in mind,would be really helpful.

lighta commented 5 years ago

Oh I made it work, sorry I forgot to send it to you. Only issue is that I changed job and didn't took it with me :(. I'll try to see if I can reach someone to send me my modification.

nikhil4595 commented 5 years ago

That would be really great @lighta thank you.

01baftb commented 4 years ago

I had tried using the HID interface, but couldn't get it to work. If you are able to get it to work, migrating over to HID so that the GUI still works would be very beneficial.

@awctomlinson

Firstly I have to say thank you for creating pyCrafter4500. It is very helpful. I just stumbled upon this project as I was trying to figure out how I can control the Lightcrafter 4500 module using Python. Previously I was using controlling it using I2C via LabVIEW and Arduino.

Have you tried using HID interface to send USB commands? Using cython-hidapi, I was able to get basic communications working on the 4500 DLP.

mattjaffe42 commented 3 years ago

@awctomlinson Thank you for writing and sharing pyCrafter4500!!!! I'm just starting to try using it to put bitmap images onto the DMD mirrors (light engine removed).

I had a question about the drivers. Once installing libusb-win32 with Zadig, as mentioned, this breaks the GUI. Is there a way to switch drivers back to toggle between GUI and pyCrafter4500 work every once in a while? So far I haven't been able to restore GUI functionality, even with reinstallation.

@lighta @nikhil4595 @01baftb: did you say you got a fork working with HID interface working so that GUI and pyCrafter can both be used? If so, would you mind sharing? Thanks in advance!!

arrrobase commented 3 years ago

It's been several years, but I think to get the GUI working again I had to go into Windows Device Manager and uninstall the Zadig driver there, and then next time the LCR was plugged in it would get recognized. I moved on to other projects before I could implement proper HID support, so I'd welcome any PRs to get that working.

On Wed, Oct 28, 2020 at 3:06 PM mattjaffe42 notifications@github.com wrote:

@awctomlinson https://github.com/awctomlinson Thank you for writing and sharing pyCrafter4500!!!! I'm just starting to try using it to put bitmap images onto the DMD mirrors (light engine removed).

I had a question about the drivers. Once installing libusb-win32 with Zadig, as mentioned, this breaks the GUI. Is there a way to switch drivers back to toggle between GUI and pyCrafter4500 work every once in a while? So far I haven't been able to restore GUI functionality, even with reinstallation.

@lighta https://github.com/lighta @nikhil4595 https://github.com/nikhil4595 @01baftb https://github.com/01baftb: did you say you got a fork working with HID interface working so that GUI and pyCrafter can both be used? If so, would you mind sharing? Thanks in advance!!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SivyerLab/pyCrafter4500/issues/1#issuecomment-718236025, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS6WT3ORIT2MOIWQR4M6OTSNCIWVANCNFSM4EFAVZMQ .

mattjaffe42 commented 3 years ago

Got it, thanks! For anyone who comes by this in the future, this worked!

You may have to uninstall/unplug/replug multiple times, until no devices show up under the "libusb-win32 devices" Device Manager category. The DLP4500 then shows up only in "Universal Serial Bus Controllers" category (for pyCrafter4500, the DLP4500 shows up under both categories). At this point, (and when the GUI is working), Zadig indicates the device driver is "HidUsb (v10.0.19041.1)".

Next, I also required a computer restart (without it, GUI still didn't recognize the DLP4500). But after the restart, the GUI recognizes the DLP4500 again!

01baftb commented 3 years ago

@awctomlinson Thank you for writing and sharing pyCrafter4500!!!! I'm just starting to try using it to put bitmap images onto the DMD mirrors (light engine removed).

I had a question about the drivers. Once installing libusb-win32 with Zadig, as mentioned, this breaks the GUI. Is there a way to switch drivers back to toggle between GUI and pyCrafter4500 work every once in a while? So far I haven't been able to restore GUI functionality, even with reinstallation.

@lighta @nikhil4595 @01baftb: did you say you got a fork working with HID interface working so that GUI and pyCrafter can both be used? If so, would you mind sharing? Thanks in advance!!

@mattjaffe42 Sorry for delayed response. I don't use libusb-win32 method like @awctomlinson did to communicate with the DLP using Python. I used the cython-hidapi module instead. This works with the default drivers installed by the DLP thus both GUI and Python can work without having to manual switch drivers. Below is an example code to connect with the DLP using Python. Note, you can NOT have the Lightcrafter GUI app open at the same time while your Python based app is connected to the DLP.

I recall sometimes having issues with the DLP being connected with the USB but it not being detected by the Lightcrafter GUI, thus not also by Python. In this case, I used go to Device Manager, uninstall the default drivers, disconnect the USB and reconnect. This fixed all issues. This is a Windows/driver issue (beyond my understanding) and NOT a Python issue. To uninstall the default driver, find the device in category "Human Interface Devices" with the vendor id 0x0451 and product id 0x6401.

import hid # https://github.com/trezor/cython-hidapi

VENDOR_ID = 0x0451
PRODUCT_ID = 0x6401

dlp = hid.device()
dlp.open(VENDOR_ID, PRODUCT_ID) 
dlp.set_nonblocking(1)

print(dlp.get_manufacturer_string())
print(dlp.get_product_string())
print(dlp.get_serial_number_string()) 
arrrobase commented 3 years ago

@01baftb This is great, thank you! Do sending commands still work the same after the initial USB connection? Is this a simple drop in replacement for the USB portion?