Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-09-2020, 01:26 AM   #1
Registered: Dec 2017
Posts: 34

Rep: Reputation: Disabled
Exclamation USB GadgetFS: write() function call blocks indefinitely

I've been working on an ARM9 device with Linux kernel 3.2, which acts as a USB peripheral when connected to a PC. To this end, I use GadgetFS feature built within the kernel.
It's been working properly; however recently, I've encountered a frustrating issue: After receiving bulk commands and transmitting bulk data over USB for a random time interval, the "write()" function call starts to block indefinitely for no apparent reason, causing my Sender Posix Thread to become unresponsive. Restarting the application temporarily solves the problem (which makes me suspect that this is a software-related issue). I also tried closing the source, sink, and ep0 file descriptors and reopening them whenever this error occurs, but even after reopening the endpoints, the "write()" function never seems to work properly.
As for the source code, I'm using the one provided as an example at
What do you think could be causing this?
Thanks in advance,
Old 09-15-2020, 01:01 AM   #2
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,478
Blog Entries: 11

Rep: Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443Reputation: 3443
Apparently not much help available for that problem here.

You might get a better response by going straight to the source where you obtained the code.

When posting questions here it is preferable to work up a minimal code example which demonstrates the problem, then post that code block along with your question. Asking others to go to another site to see your code, or to sift and debug a complete application's source code generally does not produce many interested parties.

Please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!

Good luck!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Simple read line_ function hangs indefinitely andrew.comly Programming 11 07-11-2016 05:45 AM
[SOLVED] read function call returning more amount of data than wiritten using write function chakka.lokesh Programming 1 09-11-2014 03:14 AM
[SOLVED] sleep( ) call causes whole GNU Linux system to hang indefinitely wtruong Programming 14 06-27-2011 04:06 AM
[SOLVED] Threaded function cannot call a function with extern "C" but nonthreaded function can morty346 Programming 16 01-12-2010 05:00 PM
USB gadget API framework with gadgetfs lqrk Programming 0 10-31-2008 05:51 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration