Posts: 20
Joined: Fri Dec 21, 2012 5:09 pm

QT4 umount usb drive

Sun Oct 11, 2015 2:07 pm


I wrote a full QT4 front-end application which runs on my Raspberry Pi B+ with a 4.5" screen for a web-radio + reading from USB pens.
I never add a problem coding C++/QT4 on Raspberry Pi, but this time I am stuck.

This is what it looks like (here running on my Windows Host to take screenshot).

I have my eject button grayed if no USB pen is inserted and clickable when one is inserted.
Now when I click the button, I want to unmount it, but no way. My application run as Pi user.
I can unmount it simply in a shell window using "umount /media/usbkey", but from QT4 it does not work.
Here the simple function trying to do this:

Code: Select all

void MyMainForm::eject_usb()
    QStringList parameters;
    QProcess ps;
    ps.start("umount", parameters);
I have tried to install the eject package then doing:

Code: Select all

ps.start("eject", parameters);
not better, does not work.
I tried many command like "sudo -u pi umount /media/usbkey", "sudo eject /media/usbkey" without luck.

Here my fstab entry:

Code: Select all

/dev/sda1       /media/usbkey   vfat    users,rw,umask=111,dmask=000,nofail,utf8        0       0
Any help would be very appreciated.

Return to “C/C++”