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. USB storage cross-platform support?
Forum Updated to NodeBB v4.3 + New Features

USB storage cross-platform support?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k 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.
  • A Offline
    A Offline
    alexbottoni
    wrote on last edited by
    #1

    I'm writing a small Linux app that will need to store some data on a removable USB flash drive, reusing it from time to time. To be more precise, I will need to:

    1. Detect if/when a new USB (storage) device get connected to the system
    2. Enumerate the connected USB devices (to search for the right USB drive)
    3. Read the Serial_Number/ID/Name of the connected USB devices (in order to identify the right device)
    4. Read/Write files from/to the USB storage device

    That is: it is not just a matter to read/write from/to a known device (a device listed in /dev and of known ID/Name). I also need to query the host system for some info about the available devices.

    Of course, I can rely on udev (and maybe HAL and/or DBUS) to perform such a task but this would end up in a quite Linux-specific solution written on top of a cross-platform library (Qt itself). Not very clever...

    So, I wonder if Qt has its own (cross-platform) tools for managing the USB storage devices (just USB removable hard disks, not USB interactive HID peripherals). I was unable to find any mention to USB in the Qt Documentation and forums. Does anybody has any info/link/suggestion?

    Thanks

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      I think the reason you find no mention of USB is because... well it is generic storage, it doesn't matter if it is P-ATA, S-ATA, USB, Firewire, Thunderbolt or whatever, it is just storage. This is a responsibility of the OS to provide in the form of generic storage, and that is what Qt uses. There are ways to determine whether a storage device is USB or not, but those are platform specific, you will have to create different platform specific solutions and chose the right one during compilation using preprocessor conditional directives.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexbottoni
        wrote on last edited by
        #3

        Thanks ddriver. You confirmed my understanding of this topic. I will go on with a Linux-specific solution for the moment.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Note that there is code in QtMobility (that should work just fine on the desktop as well) to enumerate system drives.

          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