Klaus Gradinger | 4 Nov 2010 14:53
Picon

How to cancel pending syncSubmit Events?

Hello,

I've been running into the following Problem: I'm communicating using a USB Handheld Barcode Scanner (USB HID Keyboard Device). Everything is fine, i've opened the IN Endpoint using the UsbPipe and access it the following way:

  currentDui = new DefaultUsbIrp(buffer);
  currentDui = new DefaultUsbIrp(buffer);
  currentDui.setAcceptShortPacket(true);

  usbScannerPipe.syncSubmit(currentDui);

I receive the data i'm expecting and everything works fine UNTIL i want to abort and cancel everything:

  usbScannerPipe.abortAllSubmissions();
  usbScannerPipe.close();
  usbScannerPipe = null;
  usbScannerInterface.release();
  usbScannerInterface = null;

The problem is that syncSubmit immediately synchronizes using  "submitLock" (UsbPipeImp). After that the whole thing just keeps blocking while waiting for data. When i call abortAllSubmissions from another Thread, it too locks on "submitLock", waiting for the submitSync method to release this lock. IF i scan another Barcode, the syncSubmit method returns and everything is fine, otherwise it's a perfect deadlock.

What's the correct work-flow here? how can i cancel everything pending and close the pipe and interface?

i'm using Ubuntu 10.04, and java-usb 1.0.1

Thanks in advance
Klaus Gradinger
 

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Hardik Shah | 3 Feb 2013 11:55

Re: How to cancel pending syncSubmit Events?

Klaus Gradinger <klaus.gradinger <at> gmail.com> writes:

> Hello, I've been running into the following Problem: I'm communicating using a
USB Handheld Barcode Scanner (USB HID Keyboard Device). Everything is fine, i've
opened the IN Endpoint using the UsbPipe and access it the following way: 
currentDui = new DefaultUsbIrp(buffer);  currentDui = new
DefaultUsbIrp(buffer);  currentDui.setAcceptShortPacket(true); 
usbScannerPipe.syncSubmit(currentDui);I receive the data i'm expecting and
everything works fine UNTIL i want to abort and cancel everything: 
usbScannerPipe.abortAllSubmissions();  usbScannerPipe.close();  usbScannerPipe =
null;  usbScannerInterface.release();  usbScannerInterface = null;The problem is
that syncSubmit immediately synchronizes using  "submitLock" (UsbPipeImp). After
that the whole thing just keeps blocking while waiting for data. When i call
abortAllSubmissions from another Thread, it too locks on "submitLock", waiting
for the submitSync method to release this lock. IF i scan another Barcode, the
syncSubmit method returns and everything is fine, otherwise it's a perfect
deadlock.What's the correct work-flow here? how can i cancel everything pending
and close the pipe and interface?i'm using Ubuntu 10.04, and java-usb
1.0.1Thanks in advanceKlaus Gradinger 
> 
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a 
> Billion" shares his insights and actions to help propel your 
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> 
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
> 

Hello,

I am facing exactly the same problem. Are you able to resolve the problem you
mentioned. if yes please let me know the steps..

Many thanks

Shah

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
Dan Streetman | 3 Feb 2013 19:27
Picon

Re: How to cancel pending syncSubmit Events?

This is a 2+ year old thread, but I believe my response back then was
to use asyncSubmit instead of syncSubmit.

It may be a bug if abortAllSubmissions() doesn't wake up a pending
syncSubmit(), but I do not own this project anymore, Brian W does, he
is also on this mailing list so he may be able to provide more info.

On Sun, Feb 3, 2013 at 5:55 AM, Hardik Shah <hardik.shah <at> jetmobile.com> wrote:
> Klaus Gradinger <klaus.gradinger <at> gmail.com> writes:
>
>> Hello, I've been running into the following Problem: I'm communicating using a
> USB Handheld Barcode Scanner (USB HID Keyboard Device). Everything is fine, i've
> opened the IN Endpoint using the UsbPipe and access it the following way:
> currentDui = new DefaultUsbIrp(buffer);  currentDui = new
> DefaultUsbIrp(buffer);  currentDui.setAcceptShortPacket(true);
> usbScannerPipe.syncSubmit(currentDui);I receive the data i'm expecting and
> everything works fine UNTIL i want to abort and cancel everything:
> usbScannerPipe.abortAllSubmissions();  usbScannerPipe.close();  usbScannerPipe =
> null;  usbScannerInterface.release();  usbScannerInterface = null;The problem is
> that syncSubmit immediately synchronizes using  "submitLock" (UsbPipeImp). After
> that the whole thing just keeps blocking while waiting for data. When i call
> abortAllSubmissions from another Thread, it too locks on "submitLock", waiting
> for the submitSync method to release this lock. IF i scan another Barcode, the
> syncSubmit method returns and everything is fine, otherwise it's a perfect
> deadlock.What's the correct work-flow here? how can i cancel everything pending
> and close the pipe and interface?i'm using Ubuntu 10.04, and java-usb
> 1.0.1Thanks in advanceKlaus Gradinger
>>
>> ------------------------------------------------------------------------------
>> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
>> David G. Thomson, author of the best-selling book "Blueprint to a
>> Billion" shares his insights and actions to help propel your
>> business during the next growth cycle. Listen Now!
>> http://p.sf.net/sfu/SAP-dev2dev
>>
>> _______________________________________________
>> javax-usb-devel mailing list
>> javax-usb-devel <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>>
>
> Hello,
>
> I am facing exactly the same problem. Are you able to resolve the problem you
> mentioned. if yes please let me know the steps..
>
> Many thanks
>
> Shah
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
Klaus Gradinger | 5 Feb 2013 09:07
Picon

Re: How to cancel pending syncSubmit Events?

i just checked my source on how i fixed it exactly and
"asyncSubmit(irp)" with an followed "irp.waitUntilCompleted()" was
what did the trick for me.

Kind regards,
Klaus

On Sun, Feb 3, 2013 at 7:27 PM, Dan Streetman <ddstreet <at> ieee.org> wrote:
> This is a 2+ year old thread, but I believe my response back then was
> to use asyncSubmit instead of syncSubmit.
>
> It may be a bug if abortAllSubmissions() doesn't wake up a pending
> syncSubmit(), but I do not own this project anymore, Brian W does, he
> is also on this mailing list so he may be able to provide more info.
>

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

Gmane