Mount userspace directory as "/dev" block device for USB Gadget API?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Mount userspace directory as "/dev" block device for USB Gadget API?
Hi all,
On my embedded ARM platform I try to set up an USB "device" which contains the file/folder structure of an UPnP Server.
A USB host (e.g. the Windows PC) should be able to view the contents of the UPnP Server.
To accomplish this I tried the following:
- I successfully use FUSE+DJMount to mount an Upnp-Server to a userspace directory (/tmp/upnp).
- I successfully load the Kernel Module "g_file_storage.ko" with e.g. "file=/dev/sda1" to set up a USB device (with die filesystem of a USB stick, connected to the ARM dev. board).
BUT: When I try to load the Kernel Module "g_file_storage.ko" with my userspace directory "file=/tmp/upnp" it comes to the following error message:
insmod: cannot insert '../g_file_storage.ko': Is a directory (-1): Is a directory
modprobe: failed to load module g_file_storage
In the documentation of the Kernelmodule g_file_storage it says that only block devices or single files (partitions) can be loaded. So this explains why modprobe fails!
Now I'm looking for a way to either mount my "tmp/upnp" directory to a /dev/xyz device or to configure the Kernel module "g_file_storage" to support userspace directories...
Or, can my FUSE file system be found in the /dev tree?
It took me a while to figure out your situation, but I think I've got it now. You're trying to make your Linux host into a giant thumb drive, right? Since the USB Gadget API binds the USB to a block device, and your Fuse filesystem is really a 'fake' filesystem, there is no block device to which the USB Gadget can bind. Sounds to me like you're hooped, unless you convert your Fuse filesystem to a bona fide block device running in kernel space. Too bad; it would have been a nice way to accomplish your objective.
--- rod.
It took me a while to figure out your situation, but I think I've got it now. You're trying to make your Linux host into a giant thumb drive, right?
Hi thNbomr,
thanks for your answer, you got my situation completely right!
Since there are a lot of applications which use FUSE as virtual Filesystem I thought it would be a good approach to connect it to the USB Gadget API!
As you got my situation right, can you think of another solution to my problems?
I can't believe that there is no FUSE to /dev "wrapper" ...
Sorry, I just don't see your approach working. A filesystem is not a block device. Maybe somewhere out there is a "Block Device in User Space" package. If not, here's your chance for fame and glory. :-)
--- rod.
On my embedded ARM platform I try to set up an USB "device" which contains the file/folder structure of an UPnP Server.
A USB host (e.g. the Windows PC) should be able to view the contents of the UPnP Server.
To accomplish this I tried the following:
- I successfully use FUSE+DJMount to mount an Upnp-Server to a userspace directory (/tmp/upnp).
- I successfully load the Kernel Module "g_file_storage.ko" with e.g. "file=/dev/sda1" to set up a USB device (with die filesystem of a USB stick, connected to the ARM dev. board).
BUT: When I try to load the Kernel Module "g_file_storage.ko" with my userspace directory "file=/tmp/upnp" it comes to the following error message:
insmod: cannot insert '../g_file_storage.ko': Is a directory (-1): Is a directory
modprobe: failed to load module g_file_storage
In the documentation of the Kernelmodule g_file_storage it says that only block devices or single files (partitions) can be loaded. So this explains why modprobe fails!
Now I'm looking for a way to either mount my "tmp/upnp" directory to a /dev/xyz device or to configure the Kernel module "g_file_storage" to support userspace directories...
Or, can my FUSE file system be found in the /dev tree?
I hope you can point me in the right direction,
Thanks in advance,
Robert
HI,Robert:
Now,I have the same problems with you? Didn't you fix it?
Thanks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.