-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support removable device #29
Comments
I think that we need to add the possibility to "connect" uMTP to udev or something else to detect the disks removal/insertion. Then uMTP can send an MTP removal/insertion event to the PC. |
@pcercuei : This is now done on the trunk. You can now mount/unmount a store in command line. Once umtprd is running you can use the -cmd: option to send commands to the daemon. umtprd -cmd:mount:home\ folder Can you now easily use udev to execute these command lines when a media is inserted/ejected. Please also note that there is now a new "notmounted" option in the config file to keep a store unmounted by default at startup. See the config file on the repository for the usage. |
Fantastic news! I'll test it ASAP. |
I can't get it to work properly... My umtprd.conf contains:
I type:
I get:
|
Is umtprd running ? No particular message regarding the queue creation when the umtp daemon is started ? |
Sorry for the delay. I had to had a UART to be able to debug MTP. I get:
Looks like I miss the system-V IPC in my kernel. I'll enable it and try again. |
Hey guys, I've been testing this feature also. Everything seems to work for me with it as long as the device is connected to a host. I can plug and unplug the sd card without problem. However, if I disconnect the device from a host and then add/remove sd card I see no log output from umtprd (DEBUG is enabled) and it seems to hang at that point. It will no longer reconnect to a host afterward. I'm using functionfs for the setup and udev rules to trigger the mount/unmount commands. I'm still digging through the code to understand the cause of this. By the way, thanks for this excellent bit of code and the continued support of it! |
Adding a bit more info, it seems the process terminates and goes zombie in the above scenario. Steps to recreate:
|
Thanks. I need to test this case (functionfs + drive removal while disconnected) |
I'm having the problem that on my OS the external media (e.g. SD cards) are mounted according to their name, so I can't know their mountpoint in advance to add them to the umtprd.conf... |
Hey Paul, Not sure if you ever got this problem resolved in your last comment. But I used udev rules to automagically make symlinks in /dev based on the sys fs physical device address connecting. So for instance, a udev rule could be added to say every time a micro sd card is inserted create a /dev/usd symlink that points to it's block device, and a /dev/usd# symlink for each partition. And those are the devices I referenced in the config file. |
Hey guys, I got some time to run some gdb today and this seems to be the cause of the crash I have seen: Unplugging the gadget from the host causes umtprd to close the fs db Removing the card now tries to use that db when unmount is sent. msgqueue.c -> msgqueue_thread() runs unmount which calls get_entry_by_storageid() which calls the following while db is null:
A quick fix for me seems to be:
After this small change its working great in my short period of testing. If this looks like a valid solution, I opened a pull request #49 . Thanks! |
Hi @twsmith85, I don't understand how udev can help you - the storage entries in the umtprd.conf contain mount points, and not dev node paths... |
Ah, right, I should have been clearer. I'm on an embedded system using BuildRoot. Our udev rules handle both physical port identification and mounting. We are also using a single micro sd port for storage that will always be mounted to /media/storage/storage1 using the udev rules. Maybe this is not an option on your setup. Here's the add section of that udev rule in case it helps give an idea on your system (Added Devpath filter with edit):
|
@twsmith85 my udev rule: https://github.com/OpenDingux/buildroot/blob/opendingux/board/opendingux/target_skeleton/etc/udev/rules.d/61-automount.rules I mount removable devices according to their partition name. I guess I could symlink these into a /media/storage/storageX like you do, but that means I would need generic names in umtprd.conf for the removable storage devices and the MTP volumes. Ideally the MTP volumes would be named after the partition names. |
I've been working on adding a Adding a |
i will check this tomorrow but i think that storages can be removed. |
I'm facing a problem and I'm not sure how to fix it.
I want uMTP-R to expose a micro-SD card, if it's plugged to my system. The mountpoint is a directory inside /media whose name is the label of the filesystem, so not a fixed one (but I may be able to change that if needed).
What I do right now, is have /media as a MTP volume. /media is a 64-kB tmpfs, since it only ever contains mountpoints and no actual data. It works fine on Linux, but Windows will refuse to copy since it detects that the drive is 64-kB.
Do you have an idea how I could make this setup work?
The text was updated successfully, but these errors were encountered: