Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unmounting USB device through Qt

Unmounting USB device through Qt

Scheduled Pinned Locked Moved Solved General and Desktop
usb
14 Posts 4 Posters 7.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mrjj
    24 Feb 2016, 07:44

    Hi
    If you need it only for windows?
    Maybe just use a command line tool?
    http://www.uwe-sieber.de/drivetools_e.html
    And call it from your program.

    Alternative, you can have a look here for inspiration
    https://support.microsoft.com/en-us/kb/165721

    M Offline
    M Offline
    marlenet15
    wrote on 24 Feb 2016, 15:59 last edited by
    #4

    @mrjj it is going to be on Linux. So for Linux, when I am running my Qt application, does the Terminal need to pop up in order for the user to enter it to eject the USB? or can it be done behind the scenes. The reason is because the Qt application is going to be run on a touchscreen and the just pressing on the QPushButton will make it easier for the user to eject. The user will not have Admin privileges.

    T 1 Reply Last reply 24 Feb 2016, 16:11
    0
    • M marlenet15
      24 Feb 2016, 15:59

      @mrjj it is going to be on Linux. So for Linux, when I am running my Qt application, does the Terminal need to pop up in order for the user to enter it to eject the USB? or can it be done behind the scenes. The reason is because the Qt application is going to be run on a touchscreen and the just pressing on the QPushButton will make it easier for the user to eject. The user will not have Admin privileges.

      T Offline
      T Offline
      the_
      wrote on 24 Feb 2016, 16:11 last edited by
      #5

      @marlenet15

      Are USB Devices automatically mounted when they are plugged in?

      -- No support in PM --

      M 1 Reply Last reply 24 Feb 2016, 16:15
      0
      • T the_
        24 Feb 2016, 16:11

        @marlenet15

        Are USB Devices automatically mounted when they are plugged in?

        M Offline
        M Offline
        marlenet15
        wrote on 24 Feb 2016, 16:15 last edited by
        #6

        @the_ yes they are. By USB i mainly mean like a flash drive which they are mainly in /media/user/

        T 1 Reply Last reply 24 Feb 2016, 16:32
        0
        • M marlenet15
          24 Feb 2016, 16:15

          @the_ yes they are. By USB i mainly mean like a flash drive which they are mainly in /media/user/

          T Offline
          T Offline
          the_
          wrote on 24 Feb 2016, 16:32 last edited by
          #7

          @marlenet15

          you can try to call

          pmount /media/path/to/flashdrive
          

          -- No support in PM --

          M 1 Reply Last reply 24 Feb 2016, 16:47
          2
          • T the_
            24 Feb 2016, 16:32

            @marlenet15

            you can try to call

            pmount /media/path/to/flashdrive
            
            M Offline
            M Offline
            marlenet15
            wrote on 24 Feb 2016, 16:47 last edited by
            #8

            @the_ Is pmount from a library? I can't seem to find one for it.

            T 1 Reply Last reply 24 Feb 2016, 16:51
            0
            • M marlenet15
              24 Feb 2016, 16:47

              @the_ Is pmount from a library? I can't seem to find one for it.

              T Offline
              T Offline
              the_
              wrote on 24 Feb 2016, 16:51 last edited by
              #9

              @marlenet15

              pmount is a shell command.

              -- No support in PM --

              M 2 Replies Last reply 24 Feb 2016, 17:14
              0
              • T the_
                24 Feb 2016, 16:51

                @marlenet15

                pmount is a shell command.

                M Offline
                M Offline
                marlenet15
                wrote on 24 Feb 2016, 17:14 last edited by marlenet15
                #10

                @the_ So does the Qt application need to open the Terminal window in order for "pmount /media/path/to/flashdrive" to work? Or can I still send the command without opening the Terminal window. In other words, I don't want the user to mess with the Terminal. I just would like for them to press the button and their flash drive should unmount.

                I tried using the following but it doesn't unmount:

                QStringList parameters;
                parameters<<"/media/user/nameOfFlashdrive/";
                QProcess ps;
                ps.start("pumount", parameters);
                
                ps.waitForFinished(-1);
                
                1 Reply Last reply
                0
                • T the_
                  24 Feb 2016, 16:51

                  @marlenet15

                  pmount is a shell command.

                  M Offline
                  M Offline
                  marlenet15
                  wrote on 24 Feb 2016, 17:34 last edited by
                  #11

                  @the_ Ok I had to install "pmount" and It works but not really. The USB folder disappears but it is still under media device on the File Manager window. Do you happen to know if "pumount" ejects the usb safely?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 24 Feb 2016, 18:37 last edited by mrjj
                    #12

                    Hi
                    pmount is a wrapper for the normal mount command
                    allowing normal user (non root) to
                    mount devices.

                    As far as I know, the pumount is used for unmounting devices?
                    as least here on ubuntu it seems to work pretty safe.

                    M 1 Reply Last reply 24 Feb 2016, 18:41
                    0
                    • M mrjj
                      24 Feb 2016, 18:37

                      Hi
                      pmount is a wrapper for the normal mount command
                      allowing normal user (non root) to
                      mount devices.

                      As far as I know, the pumount is used for unmounting devices?
                      as least here on ubuntu it seems to work pretty safe.

                      M Offline
                      M Offline
                      marlenet15
                      wrote on 24 Feb 2016, 18:41 last edited by
                      #13

                      @mrjj so by just running "pumount" it will unmount the usb safely?

                      M 1 Reply Last reply 24 Feb 2016, 18:44
                      0
                      • M marlenet15
                        24 Feb 2016, 18:41

                        @mrjj so by just running "pumount" it will unmount the usb safely?

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 24 Feb 2016, 18:44 last edited by
                        #14

                        yes it should.
                        you can read about it here
                        http://manpages.ubuntu.com/manpages/utopic/man1/pumount.1.html

                        it seems to expect the device to be mounted under /media.

                        1 Reply Last reply
                        1

                        13/14

                        24 Feb 2016, 18:41

                        • Login

                        • Login or register to search.
                        13 out of 14
                        • First post
                          13/14
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved