On 1.4.2013 8.31, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
>On Sun, Mar 31, 2013 at 1:27 PM, Kustaa Nyholm ><kustaa.nyh...@planmeca.com> wrote: >> BUT under the hood libusbx uses the native API >> on each platform to access USB right? >> >> And I can call any native API from Java with >> JNA without ANY native code and the C tool >> chain issues...so what I really should do is >> to re-write libusbx in Java! Just like >> my PureJavaComm project does. > >Is this really feasible? Even if it is feasible, you >are kind of re-inventing the wheel. > >Why not just improve the existing Java bindings >of libusbx instead? Well, I'm not sure if I was serious or not but the 'problem' with libusbx for a Java programmer (and to some extent end user as well) is that it is written in C. C is a nice little language for this sort of thing, but the tool chain is a mess. Witness the endless little tweaks for getting it to compile cleanly on all the supported platforms with all the supported tool chains. And for a cross platform developer, if binaries are not available, it is a real headache to compile for all platforms be it cross or native compile. Not speaking of specifically of libusb(x) but if there is a patch I need and binaries are not available I'm more or less stuck. Then there is the issue of delivering the native library. So far I've been able to deliver my applications in a single executable jar file that works on Linux, Windows and Mac OS X. No installer required, perfect from my point of view. And like I said, for better acceptance on each platform I deliver the code as single .exe or .app as well. Now, if I need to use a native library I need to provide an installer on Windows at least. Granted an installer on Windows is what the end user expects but it is an additional burden for me and the concept of an installer (why do you need one?) is so broken for me that I try to avoid it. I could of course figure out how to store the .dll inside my .jar/.exe and extract it at run time, that has been done several times, but more pain for me. Having said that I see the day coming when I do need an installer or some new clever mechanism anyway because in the future it is mandatory to embed JRE and I don't see how that can be done at least on Windows/Linux without an installer. So while re-coding libusbx in Java would be sort of re-inventing the wheel it would solve above issues for the Java programmers and thus I think it would be very welcome. Feasible? At the moment, not for me no. And there is an other issue with libusb(x), while above, speculated, Java port would solve the issues mentioned then there are the drivers. My knowledge on the present situation is dated and probably wrong but driver installation is something I would very, very much like to skip altogether. So my thinking is that the next step, if any, for me is to move from my present CDC ACM solution, which is (almost) driverless and requires no native libraries with JNA and my PureJavaComm, to a HID solution. HID would seem to be good enough for what I need to do and would solve the driver issue. I've had a preliminary peek at the signal11 hidapi code and while not a trivial task it seems feasible to re-code that in pure Java using JNA. That would be a driverless, cross platform, Pure Java solution for many, many applications. On the face of it, that looks like a winner to me. We'll see if I ever get round to that or if someone else picks up the ball before me. cheers Kusti This e-mail may contain confidential or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. We will not be liable for direct, indirect, special or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on or as of transmission of this e-mail in general. ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel