Tim Noell | 8 Oct 2010 22:21
Picon

Possible Bug in javax-usb-ri-linux_1.0.2 on 32-bit architectures

Hi javax-usb-devel:

I just recently upgraded to 1.0.2 and found a problem ...

Target is 32-bit architecture.

In src/com/ibm/jusb/os/linux/LinuxPipeRequest.java  line 123
the type of urbAddress is a java long (64-bit)

In jni/JavaxUsbPipeRequest.c, line 76, where setUrbAddress() is called, the urb is a 32-bit pointer.
If it is not cast to jlong, then later when we call getUrbAddress, we get garbage.

Here is a changeset that add the jong cast and fixes it for 32-bit architectures:
                log( LOG_XFER_REQUEST, "Submitted URB" );
-               CheckedCallVoidMethod( env, linuxPipeRequest, setUrbAddress, urb );
+               CheckedCallVoidMethod( env, linuxPipeRequest, setUrbAddress, (jlong)urb );

Probably worked just fine on 64-bit, and maybe was not regressed on 32-bit ???

Anyway, FYI,
T.

--
// "Only dead fish go with the flow"
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Brian Weischedel | 13 Oct 2010 20:15
Picon
Favicon

Re: Possible Bug in javax-usb-ri-linux_1.0.2 on 32-bit architectures

Tim,
Thanks for the info. I will add it to my list of things to look into and fix the next time I am updating the code.


Brian Weischedel bweisch <at> us.ibm.com



Tim Noell ---10/08/2010 04:22:33 PM---Hi javax-usb-devel: I just recently upgraded to 1.0.2 and found a problem ...


From:

Tim Noell <tnoell <at> gmail.com>

To:

javax-usb-devel <at> lists.sourceforge.net

Date:

10/08/2010 04:22 PM

Subject:

[javax-usb-devel] Possible Bug in javax-usb-ri-linux_1.0.2 on 32-bit architectures



Hi javax-usb-devel:
I just recently upgraded to 1.0.2 and found a problem ...

Target is 32-bit architecture.

In src/com/ibm/jusb/os/linux/LinuxPipeRequest.java  line 123
the type of urbAddress is a java long (64-bit)

In jni/JavaxUsbPipeRequest.c, line 76, where setUrbAddress() is called, the urb is a 32-bit pointer.
If it is not cast to jlong, then later when we call getUrbAddress, we get garbage.

Here is a changeset that add the jong cast and fixes it for 32-bit architectures:
                log( LOG_XFER_REQUEST, "Submitted URB" );
-               CheckedCallVoidMethod( env, linuxPipeRequest, setUrbAddress, urb );
+               CheckedCallVoidMethod( env, linuxPipeRequest, setUrbAddress, (jlong)urb );

Probably worked just fine on 64-bit, and maybe was not regressed on 32-bit ???

Anyway, FYI,
T.

--
// "Only dead fish go with the flow"------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Gmane