Open mgmax opened 2 years ago
As discussed here https://github.com/t-oster/VisiCut/discussions/605#discussioncomment-643395 , the error disappears if K40Whisperer is started (and probably closed again) before using VisiCut.
So the problem is that VisiCut does not detach the USB driver of the CH341 device. Probable solution is something like "int r = LibUsb.detachKernelDriver(handle, interfaceNum); " somewhere near claimInterface in https://github.com/t-oster/LibLaserCut/blob/master/src/main/java/de/thomas_oster/liblasercut/drivers/K40NanoDriver.java
@tatarize Could you maybe have a look? Or someone else who has access to such a lasercutter?
Okay, cloned a fresh repo. Ran it.
LibUsbException: USB error 3: Could not claim the interface: Access denied (insufficient permissions)
Trying again, running netbeans as Administrator. Apparently not good enough I need to run Visicut directly as administrator.
-- Loading files suddenly broke.
In Raspberry pi, I believe there might be an issue with the order of operations a deep dive by a contributor in the MeerK40t project had the order there shifted a bit. As for windows I might have to figure out he proper method for DLL calls (to code a secondary default windows driver using the CH341DLL) because the need to run in admin mode is really really annoying.
Attempted again, after uninstalling and reinstalling viscut. Gave another insufficient permission error, even from root.
I ran it successfully during testing. Not sure if anything changed or if it's just being weird.
Orderwise:
For some linux installs:
Depending on things it might need the rule to permit you to access the K40. You can test this if it works with sudo visicut and works.
It sounds like the "access denied" is a separate issue that will also affect any other lasercutting program (as far as it uses libusb). Also discussed in https://stackoverflow.com/questions/28884817/usb4java-library-error-while-claiming-an-interface
Regarding "Loading files suddenly broke": Opening SVG files works for me, so can you please create an issue with more details (which file, which OS)?
Even with windows being weird raspberry pi should work, but sometimes the permission error is actually a permission error and the OS doesn't have access. If sudo fixes it, then it's actually permission.
My error recovered after reinstall. I think it was an old config file or something and didn't give me a highly specific error.
The access thing is a bit weird. Python code doesn't have that requirement. If I could call a little python script I could run this stuff without hitting any permissions issues. Though rPi would still need a rule (or sudo) to access the USB, as posted above. But, windows is fine with access without any USB snafus, for Python but not for Java.
I could add in lhyserver devices, where they accept TCP data and just send it over the USB to the device. Though this might be a somewhat rare construction. And it seems like it would need to be compiled or run in a venv or stored in the drivers or stored as a frozen .exe (which is even less desirable).
The network capabilities are desirable enough. Rig up a raspberry pi zero and control the M2 Nano by just TCP sending data to that server. Though asking that folks use a second program to get the first program to work isn't very helpful.
Discussed in https://github.com/t-oster/VisiCut/discussions/605