I’m normally more of a webdeveloper, but now I need to make a little daemon/CLI to connect to a USB label writer, which is connected to a Windows machine.
Is there an idiomatic way of doing this in Clojure (or babashka?), or a pointer to useful libs?
If you actually need to drop down to the level of USB operations, I think you will need to use something like the usb4java library. I used it with great results in my own Wayang project to drive the display on the Ableton Push 2 from my Clojure lighting controller Afterglow, although I dropped down to Java for the Wayang library itself in order to make it useful to a wider variety of developers.
Using usb4java from Clojure directly will involve using Clojure/Java interop (which is perfectly idiomatic in situations where there is a good Java library), but if you are not already familiar with both Java and interop syntax and concepts, that will be an additional learning stage and mental translation barrier beyond what usb4java imposes in its own translation between Java and the underlying C libusb library. So you might be in for some reading and hammock time!
Ah thanks, that’s excellent. I’ll check out Wayang for inspiration !
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.