Kustaa Nyholm | 1 Nov 2010 15:56
Favicon

DLL name and path...

I'm new to libusb-win32 though I've used libusb 0.1 for sometime now on
Linux and Mac OS X using a small Java wrapper for libusb 0.1 and JNA.

Now I would like to 'port' it (Java wrapper) to Windows.

As far as I understand it should just-work (tm) if it can find the DLL. I've
downloaded the libusb-win32-bin-1-1.2.2.0 and I see that the DLL is called
libusb0.dll or libusb0_x86.dll .

Why the difference in name?

It seems that this will force me to identify the operating system because I
need to pass the library name to JNA.

Is that correct?

Also the documentation says that the DLL should not be in the same directory
as the application that is using it, but somewhere in the system where the
installer puts it. 

Now, I do not know yet, if JNA automatically finds it from those locations,
if not then I will need to code in some search paths into my application
which is a bother, but I maybe jumping the gun here.

I've only got access to WinXP so I cannot realy test this on amd64 or ia64
architectures.

Any comments are welcome.

br Kusti
(Continue reading)

Travis | 1 Nov 2010 21:39
Picon

Re: DLL name and path...

On 11/1/2010 7:56 AM, Kustaa Nyholm wrote:
> I'm new to libusb-win32 though I've used libusb 0.1 for sometime now on
> Linux and Mac OS X using a small Java wrapper for libusb 0.1 and JNA.
>
> Now I would like to 'port' it (Java wrapper) to Windows.

I would guess there is little if not nothing to port? The libusb 0.1 api 
is fully compatible with libusb-win32.  I am not a java programmer, but 
It seems you would just use Java for Windows?

> As far as I understand it should just-work (tm) if it can find the DLL. I've
> downloaded the libusb-win32-bin-1-1.2.2.0 and I see that the DLL is called
> libusb0.dll or libusb0_x86.dll .
>
> Why the difference in name?

libusb0_x86.dll is 32bit.

ALL ARCHITECTURES:
   x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll
     On 64 bit, Installs to Windows\syswow64\libusb0.dll.
     On 32 bit, Installs to Windows\system32\libusb0.dll.

Have a look at libusb-win32-bin-README.txt for more details.

> It seems that this will force me to identify the operating system because I
> need to pass the library name to JNA.
>
> Is that correct?

(Continue reading)

nicogalan | 1 Nov 2010 23:33
Picon
Favicon

Re: Help on visual basic 6 usb_bulk_wite


yes!!!!!!

it's working now!!!

I did not change code I gave above.....

if I use libusb filter, then, no data is written to device :(

but if I use INF wizard, and then I install driver generated, usb can read
and write normally....

sadly, this is useless for me, what can the problem be now???

using filter, code shows write ok, but it does not write.
and if I use INF wizard, then everything is fine...
I am almost done, just a few more :)
thanks for your support :)

--

-- 
View this message in context: http://libusb.6.n5.nabble.com/Help-on-visual-basic-6-usb-bulk-wite-tp3216312p3245885.html
Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
(Continue reading)

Xiaofan Chen | 2 Nov 2010 00:38
Picon

Re: Help on visual basic 6 usb_bulk_wite

On Tue, Nov 2, 2010 at 6:33 AM, nicogalan <forgot_pwd <at> hotmail.com> wrote:
>
> yes!!!!!!
>
> it's working now!!!
>
> I did not change code I gave above.....

THat is strange as you have OUT endpoint 0x1 and IN endpoint 0x82
and your code is not tally with that.

> if I use libusb filter, then, no data is written to device :(
>
> but if I use INF wizard, and then I install driver generated, usb can read
> and write normally....

Which version of libusb-win32 are you using? How do you install
the filter. Please use the latest version and then use the device filter
GUI wizard.

> sadly, this is useless for me, what can the problem be now???
>
> using filter, code shows write ok, but it does not write.
> and if I use INF wizard, then everything is fine...
> I am almost done, just a few more :)
> thanks for your support :)
>

--

-- 
Xiaofan
(Continue reading)

Xiaofan Chen | 2 Nov 2010 02:22
Picon

Re: Help on visual basic 6 usb_bulk_wite

On Tue, Nov 2, 2010 at 6:33 AM, nicogalan <forgot_pwd <at> hotmail.com> wrote:

> if I use libusb filter, then, no data is written to device :(
>
> but if I use INF wizard, and then I install driver generated, usb can read
> and write normally....
>
> sadly, this is useless for me, what can the problem be now???
>

BTW, what is the original driver used for this device? There
is a chance that the filter may not work with certain driver.

--

-- 
Xiaofan

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
Kustaa Nyholm | 2 Nov 2010 07:22
Favicon

Re: DLL name and path...

<snip>

> Regards,
> Travis

Thanks Travis, all that was very helpful!

br Kusti

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
Xiaofan Chen | 2 Nov 2010 08:22
Picon

Re: DLL name and path...

On Mon, Nov 1, 2010 at 10:56 PM, Kustaa Nyholm
<Kustaa.Nyholm <at> planmeca.com> wrote:
> I'm new to libusb-win32 though I've used libusb 0.1 for sometime now on
> Linux and Mac OS X using a small Java wrapper for libusb 0.1 and JNA.
>
> Now I would like to 'port' it (Java wrapper) to Windows.

Just wondering if this existing solution is good for you or not.
http://sourceforge.net/projects/libusbjava/

I know next to zero about Java though...

--

-- 
Xiaofan

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
Kustaa Nyholm | 2 Nov 2010 09:11
Favicon

Re: DLL name and path...


> Just wondering if this existing solution is good for you or not.
> http://sourceforge.net/projects/libusbjava/

Well,

my current situation is that I've got an application that works and uses the
wrapper, so I'm not really looking for a solution. What I have in mind is
that I could share my wrapper with the world at large.

I was aware of the 'libusbjava' project.  I'm do not recall why I originally
rejected it in favor of my homespun implementation.

However mine is based on JNA where as libusbjava is based on JNI.

JNA requires absolutely no C/C++ code and thus you do not need to have a
working tool chain for all platforms to develop or modify it. With JNA you
write pure Java code and it just works as long as you have binary
dll/.so/.dylib file.

In the context of supporting multiple platforms the C- tool chain is a major
headache and pain in the hind quarters.

Thus JNA seems like the obvious solution for accessing something like
'libusb' from Java.

Writing this sort of wrappers with JNA is trivial, it took me about an hour
to do this and it should just work on all platforms, so my code might serve
as inspiration for e.g. writing a similar wrapper for libusb 1.0 (if it ever
gets released for Windows ;-)
(Continue reading)

Xiaofan Chen | 2 Nov 2010 09:36
Picon

Re: DLL name and path...

On Tue, Nov 2, 2010 at 4:11 PM, Kustaa Nyholm
<Kustaa.Nyholm <at> planmeca.com> wrote:
>
>> Just wondering if this existing solution is good for you or not.
>> http://sourceforge.net/projects/libusbjava/
>
>
> I was aware of the 'libusbjava' project.  I'm do not recall why I originally
> rejected it in favor of my homespun implementation.
>
> However mine is based on JNA where as libusbjava is based on JNI.
>
> Writing this sort of wrappers with JNA is trivial, it took me about an hour
> to do this and it should just work on all platforms, so my code might serve
> as inspiration for e.g. writing a similar wrapper for libusb 1.0 (if it ever
> gets released for Windows ;-)
>
> So I'm just polishing up my code before putting it up on my site and one of
> the cleanup things is to try to get the native library name and path 'right'
> for Windows, Linux and Mac OS X.

Thanks for the information. So this JNA is kind of like ctype for Python
and you do not need to write native C code for the wrappers. Nice.

I think I came across this before so I google again and there is
indeed on Java wrapper using JNA.
https://launchpad.net/libusb4j
http://kenai.com/projects/libusb4j/sources/subversion/show/libusb4j

But I have not tried it out. I assume yours is different.
(Continue reading)

Xiaofan Chen | 2 Nov 2010 09:39
Picon

Re: DLL name and path...

On Tue, Nov 2, 2010 at 4:11 PM, Kustaa Nyholm
<Kustaa.Nyholm <at> planmeca.com> wrote:
> Thus JNA seems like the obvious solution for accessing something like
> 'libusb' from Java.
>
> Writing this sort of wrappers with JNA is trivial, it took me about an hour
> to do this and it should just work on all platforms, so my code might serve
> as inspiration for e.g. writing a similar wrapper for libusb 1.0 (if it ever
> gets released for Windows ;-)
>

I think libusb-1.0 will be released for Windows. ;-)

And a Java wrapper is of course welcome. You can anyway test it
with Pete Batard's branch.

--

-- 
Xiaofan

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev

Gmane