Share via


USB NCM on Factory OS

Note

finddevice is now on github!

USB NCM (Network Control Model) is a default feature of Factory OS. It gives a Factory OS device connected to a host PC over USB a link-local IP address (169.254.0.0/16) on the host PC. If multiple Factory OS devices are connected to the same host PC they are all given unique link-local IP addresses. This allows one host PC to simultaneously communicate with any number of USB connected Factory OS devices.

Important Requirements for USB NCM support

Communicating with the Factory OS device using USB NCM

Once the USB NCM connection is established, you can communicate with the Factory OS device using its localhost IP address from the host PC as if the Factory OS device was connected to your host PC's local network via ethernet. For example, from the host PC you could:

  • Use the open-device <NCM link-local IP Address> TShell cmdlet(connect-using-tshell.md#open-device-connecting-tshell-to-target-device) to connect to the target device with TShell
  • Connect to the target device over SSH
  • Connect to the target device using the Factory Orchestrator app or Client API

The WSK includes a sample .NET Core 3.1 executable (finddevice.exe) and source code which you can run on the host PC to automatically detect the link-local IP addresses of any USB connected Factory OS devices. Run finddevice.exe -? to see the full list of arguments supported by the program.

Combining the finddevice.exe source code or executable with a PowerShell script using TShell cmdlets or a .NET Core program making Factory Orchestrator Client API calls, allows you to programmatically detect USB connected Factory OS device(s), establish a connection to the device(s), and then use those connections to programmatically interact with the connected device(s).

The pre-built executable and source code are located at: WSK\Program Files\Windows Kits\10\WSKSamples\UsbNcmFindDevice

Troubleshooting connections

If you run finddevice.exe and can't find any connected devices, check the following:

  • Make sure you've met the requirements listed above
  • Verify that your device appears in Device Manager on your host PC
    • The device should appear under Network adapters
    • The device name will be "UsbNcm Host Device"
  • Your host PC's firewall may be blocking communication between your host and your device:
    • Create a rule to allow communication from finddevice.exe
    • Enable the rule for Domain, Private, and Public network types