Detecting the insertion of an optical disk

  1. 7 months ago

    Garry P

    28 Nov 2019 Testers, Xojo Pro Europe (Torquay, UK)

    I need to do some activity in a Xojo console application (that is running as a daemon) whenever an optical disk is inserted. Does anyone have any idea how to go about this? It has to work on Linux and macOS. Windows is optional.

    Thanks,

  2. Norman P

    28 Nov 2019 Testers, Xojo Pro outside admiring the sunshine,...

    with or without plugins ?
    There are macOS API's under disk arbitration for watching for disk mounts & unmounts
    https://developer.apple.com/library/archive/documentation/DriversKernelHardware/Conceptual/DiskArbitrationProgGuide/Introduction/Introduction.html

    Windows has similar API's
    https://docs.microsoft.com/en-us/windows/win32/devio/detecting-media-insertion-or-removal

    Not sure about Linux

  3. Christian S

    28 Nov 2019 Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    For Windows check our WindowsDiskChangeMBS class in MBS Xojo Win Plugin .

    For MacOS you can check NSWorkspaceMBS class with NSWorkspaceDidMountNotification to get the notification for a new disk.
    Or CarbonApplicationEventsMBS for older projects where VolumeMounted event should still work.

  4. Garry P

    28 Nov 2019 Testers, Xojo Pro Europe (Torquay, UK)

    Helpful links guys. Thanks.

    Anyone know about Linux?

  5. Norman P

    28 Nov 2019 Testers, Xojo Pro outside admiring the sunshine,...

    I just googled for "macOS detect disk insertion" and "windows detect disk insertion"

    linux should be similar to find answers BUT you're likely to get answers that vary from distro to distro - I find that to be really common in the linux world

    for instance
    https://askubuntu.com/questions/359855/how-to-detect-insertion-of-dvd-disc

or Sign Up to reply!