3 Replies
      Latest reply on Sep 11, 2019 12:10 AM by eskimo
      thangfromvn Level 1 Level 1 (0 points)

        I followed eskimo answer on how to run script when usb device connected. But how about when it is disconnected? Do we have some event in iokit that handle this? Thank you

         

        <?xml version="1.0" encoding="UTF-8"?>

        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

        <plist version="1.0">

          <dict>

          <key>Label</key>

          <string>com.example.KeyboardAttach</string>

          <key>ProgramArguments</key>

          <array>

          <string>/usr/local/bin/xpc_set_event_stream_handler</string>

          <string>/usr/local/bin/keymapRazer</string>

          </array>

          <key>LaunchEvents</key>

          <dict>

          <key>com.apple.iokit.matching</key>

          <dict>

          <key>com.example.KeyboardAttach.Event</key>

          <dict>

          <key>idVendor</key>

          <integer>5426</integer>

          <key>idProduct</key>

          <integer>545</integer>

          <key>IOProviderClass</key>

          <string>IOUSBDevice</string>

          <key>IOMatchLaunchStream</key>

          <true/>

          </dict>

          </dict>

          </dict>

          </dict>

        </plist>