Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 12-08-2013, 09:33 PM   #1
Registered: Nov 2003
Location: Planet Earth
Distribution: Redhat, Gentoo, Mandrake, FreeBSD
Posts: 73

Rep: Reputation: 18
Question Sharing Single USB Device between multiple process/task/program/application

Hello People

Does anyone know how to share an USB device between multiple process/task/program/application? Usually, we were unable to perform in such way due to I/O locking by a single process/task/program/application. Is there anyway to overcome such problem?

Thank you
Old 12-09-2013, 06:04 AM   #2
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 6,620
Blog Entries: 12

Rep: Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298Reputation: 2298
I think you'd have to write a replacement driver which would allow for that. I was about to say that it depends what the USB is, but in any case, whether it be straight USB communications like an STM32, or USB serial like FT232, or USB access to a drive or thumbstick, the kernel has it's own drivers in place which are designed to be the interface to whatever the subservient USB device is, and all that I can think of will likely restrict to some singular point of access. I'm no expert on say the file system, but if you have a USB drive, several processes can probably have open file handles on a USB attached drive; however those processes' access points are really through the Linux file system driver.

As far as serial goes, you're not restricted totally, you can open a serial USB and I believe if you fork() another process, that new child also has the same handle. It's not advisable because you both can try to access the device, not knowing the sequence of data that's there, you can end up putting partial packets of data and interleaving them, because the two processes may not know about what each are doing. I've made that programming mistake.

What you can do is have one side be a receiver and one side be a transmitter, which is necessary sometimes in order to not lose data on the receiver when you're doing too much on the transmit side.

These could be a bunch of incorrect guesses. What USB technology do you wish to be able to access by more than one process? Why do you feel that you need to do this? And by multiple processes, do you mean processes/threads in the same programming architecture? Or do you mean entirely separate processes from different programs?


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
multiple printers - default printer for a single program kubas Linux - Software 4 04-02-2012 12:51 AM
Application process starts multiple times Programming 6 07-19-2011 08:55 PM
How to run multiple process in single command prompt babu198649 Linux - Newbie 7 10-12-2007 08:27 AM
single device - multiple icons on desktop pringle1944 Linux - Newbie 1 03-17-2006 06:09 PM
assigning multiple device aliases to single drive cerealdaemon Linux - General 5 07-25-2005 11:55 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:48 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration