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 get/generate unique Hardware ID for MAC OS
Forum Updated to NodeBB v4.3 + New Features

How to get/generate unique Hardware ID for MAC OS

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 5.4k 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.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello Experts,

    I need to get/generate a unique hardware ID for MAC OS.
    For windows OS I am using below function for unique ID, but it is not working for MAC OS.

    @
    //generate Mac address
    QString Registration::generateMac()
    {
    foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces())
    {
    // Return only the first non-loopback MAC Address
    if (!(interface.flags() & QNetworkInterface::IsLoopBack))
    return interface.hardwareAddress();
    }
    return QString();
    }
    @

    Please suggest.

    Thanks in advance.
    Zain

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      What version of Qt and Mac OS are you using?

      http://anavi.org/

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zain
        wrote on last edited by
        #3

        QT version:4.8.1
        MAC OS:Mac Lion 10.7.5

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dv879
          wrote on last edited by
          #4

          When I was searching for a solution to this problem, I came across this thread: http://stackoverflow.com/questions/933460/unique-hardware-id-in-mac-os-x
          The persons says he ended up using this:
          @
          QProcess proc;

          QStringList args;
          args << "-c" << "ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { print $3; }'";
          proc.start( "/bin/bash", args );
          proc.waitForFinished();

          QString uID = proc.readAll();
          @

          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