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. How to know usb drive detected on qt ?
Forum Updated to NodeBB v4.3 + New Features

How to know usb drive detected on qt ?

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 2.8k Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by Qt embedded developer
    #1

    i have to copy file from embedded linux based pc to usb drive.

    so for that i need to check that usb drive is detected or not ?

    how to ensure that this is usb storage device ?

    jsulmJ 1 Reply Last reply
    0
    • Q Qt embedded developer

      @jsulm i am using df -h command to find that storage device before copying file into it.

      because it give me name like

      /dev/sda

      by this i am ensuring that this is the pen drive and into this i have to copy file.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Qt-embedded-developer On Linux systems USB drives are usually mounted under /media/USERNAME/DRIVENAME.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      4
      • Q Qt embedded developer

        i have to copy file from embedded linux based pc to usb drive.

        so for that i need to check that usb drive is detected or not ?

        how to ensure that this is usb storage device ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer Qt does not provide this. But you can for example use https://libusb.info/.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply
        2
        • jsulmJ jsulm

          @Qt-embedded-developer Qt does not provide this. But you can for example use https://libusb.info/.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @jsulm i am using df -h command to find that storage device before copying file into it.

          because it give me name like

          /dev/sda

          by this i am ensuring that this is the pen drive and into this i have to copy file.

          jsulmJ 1 Reply Last reply
          0
          • Q Qt embedded developer

            @jsulm i am using df -h command to find that storage device before copying file into it.

            because it give me name like

            /dev/sda

            by this i am ensuring that this is the pen drive and into this i have to copy file.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Qt-embedded-developer On Linux systems USB drives are usually mounted under /media/USERNAME/DRIVENAME.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Q 1 Reply Last reply
            4
            • jsulmJ jsulm

              @Qt-embedded-developer On Linux systems USB drives are usually mounted under /media/USERNAME/DRIVENAME.

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #5

              @jsulm actually there are when gnome is disable at that time we not get this way the attached usb drive

              so can you tell me efficient way to mount and get the path of that pen drive

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Hi,

                What time is that ?
                System startup ?
                Before anything else is started ?
                Is it separated from your application ?
                etc.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Q 1 Reply Last reply
                1
                • SGaistS SGaist

                  Hi,

                  What time is that ?
                  System startup ?
                  Before anything else is started ?
                  Is it separated from your application ?
                  etc.

                  Q Offline
                  Q Offline
                  Qt embedded developer
                  wrote on last edited by Qt embedded developer
                  #7

                  @SGaist my pen drive get automatically get mounted on media path but after writing startup script for start only qt application on my device

                  It's stopped my usb drive auto mount on media path

                  So i am looking for this solution.

                  I want to pass this path to copy my file to pen drive.

                  But it's stopped working due to start up script.

                  Can you help how to make it work again?

                  After running application using start up script I does not have access to terminal also

                  So this is all I am facing to simply copy file to pen drive using qt application...

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    Will you initiate the update from within your application ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Q 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Will you initiate the update from within your application ?

                      Q Offline
                      Q Offline
                      Qt embedded developer
                      wrote on last edited by Qt embedded developer
                      #9

                      @SGaist sorry I am not getting what you want to say..

                      Can you elaborate more.

                      I have updated my previous reply also.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by SGaist
                        #10

                        The auto mount has not stopped working, it's part of the features of your desktop environment. Since you are not using it anymore, it's something that you have to implement as part of your application or use udev to do that. See this article for an example.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        Q 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          The auto mount has not stopped working, it's part of the features of your desktop environment. Since you are not using it anymore, it's something that you have to implement as part of your application or use udev to do that. See this article for an example.

                          Q Offline
                          Q Offline
                          Qt embedded developer
                          wrote on last edited by Qt embedded developer
                          #11

                          @SGaist this script is doing auto mount of pendrive but unmount of pendrive not working.

                          so i have decided to use mount and umount on triggering usb drive using ls -l /dev/sd* and then mount this device on media dir and then do umount on successful copy of file to pendrive

                          1 Reply Last reply
                          0

                          • Login

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