kkjkearney
Posts: 14
Joined: Wed Dec 23, 2015 3:16 pm

Inserting and removing USB Memory Stick

Fri Mar 25, 2016 2:07 pm

Just began using Jessie, and am happy to see simple USB memory stick functionality without complex mounting, etc.

First: In my application, the user will insert a memory stick, to write a captured photo to the stick. When the stick is inserted, a dialog box pops up asking the user what to do with the memory stick (only one option, "Open in File Manager"). This interrupts my application. Is there any way to prevent this pop up?

Second: Within the Python application, the user will capture some number of photos and the code will write them to the USB memory stick. Any suggestions on how to automatically dismount the USB stick? Mount and un-mount after each file is written? If so, how do I do that? I can't count on the user to click an eject icon before pulling the memory stick (users being users...).

User avatar
DougieLawson
Posts: 36097
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Inserting and removing USB Memory Stick

Fri Mar 25, 2016 4:42 pm

You can disable the pcmanfm auto-mounter.
http://forum.lxde.org/viewtopic.php?t=36329&f=3
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

kkjkearney
Posts: 14
Joined: Wed Dec 23, 2015 3:16 pm

Re: Inserting and removing USB Memory Stick

Fri Mar 25, 2016 5:40 pm

Excellent, nice and simple. Thank you Dougie. For amateurs like me, Pcmanfm is simply the default file manager that comes with Raspbian.

Can someone help with my second question... Are there simple Python commands to dismount each time a picture is saved (assuming the user is going to pull the stick), and then remount if another picture is taken/saved?

Return to “Raspbian”