2 Replies
      Latest reply on Oct 23, 2019 12:48 AM by eskimo
      liang.zhou Level 1 Level 1 (0 points)

        I know with Disk Arbitration framework, I can use DARegisterDiskMountApprovalCallback to prevent external disks from mounting. The disks includes thumb drive, external hard disk, etc., but there are many types of peripherals out there, like a usb wireless receiver or a USB ethernet adapter. Is there any other framework for us to use to enable/disable peripherals based on their I/O Registry properties? Thanks!

        • Re: Disable peripherals on macOS programmatically
          liang.zhou Level 1 Level 1 (0 points)

          Let me make my question more specific. I'd like to be able to enable/disable built-in/external network adapter(ethernet or Wi-Fi), built-in/external bluetooth adapter, etc. Is there any general method to deal with individual hardware just like Windows? Thanks!

            • Re: Disable peripherals on macOS programmatically
              eskimo Apple Staff Apple Staff (12,285 points)

              On the networking front, it depends on what you mean by “disable”:

              • If want to prevent the hardware from showing up at all, you may be able to do that at the I/O Kit level.  The typical approach is to create an I/O Kit driver that matches against the hardware more tightly than the built-in drivers, and then explicitly avoids publishing a network interface.

              • If you want to disabling the resulting network interface, you can do that using the System Configuration framework.

              Both approaches have present significant challenges.

              Share and Enjoy

              Quinn “The Eskimo!”
              Apple Developer Relations, Developer Technical Support, Core OS/Hardware
              let myEmail = "eskimo" + "1" + "@apple.com"