ResolutionFirst, it is necessary to make sure the device on the port is connected and working on the Hardware Node itself.
These steps must be completed to use parallel ports inside a Container:
1. To obtain the port name (\DosDevices\LPT1, \Device\Parallel0), run the following command on the Hardware Node:
change port /query
2. Replace indexes with the correct ones (usually, there is a simple mapping, like Parallel0->LPT1, Parallel1->LPT2, etc.).
3. Create a legacy symbolic link; most software needs this link to open and communicate with the device on the port. The following commands need to be run on the Hardware Node:
vzdevctl linkadd CTID --object \Device\Parallel0 --symlink \DosDevices\LPT1
vzdevctl linkadd CTID --object \Device\Parallel0 --symlink \Device\Parallel0
(where CTID is the container's numeric identifier).
4. Run the "change port /query" command inside the container to make sure the ports are mapped correctly:
C:\Documents and Settings\Administrator>change port /query
5. Install the device's driver (modem driver, printer driver, controller driver, etc.).
6. Install the software that is going to use the device inside the container.
The below steps need to be taken to use Serial ports, USB, and other PnP devices inside a container:
Note: Parallel or Serial ports with an "n" number correspond to the "n-1" Parallel port.
The below steps need to be taken to use USB devices inside a container:
vzdevctl add CTID --deviceid "USB\PNP0400\5&324D5432&0" --alias dev1 --connect --onboot [--exclusive]
To add a serial port, we use its PnP DeviceID:
vzdevctl add CTID --deviceid "ACPI\PNP0501\1" --alias COM1 --connect --onboot
CTID – the container's numeric identifier
--deviceid – the device system's identification, which can be retrieved from Device Manager (Device Properties, Details, Device Instance Id) or by using the "vzdevctl devtree" command on the Hardware Node
--alias – device alias (can be omitted; however, it is better to use one to avoid complicated deviceid usage)
--connect – connects the device to the running container right after adding this device to system (it is impossible to connect the device to the stopped container). If this parameter is omitted, the device will not be connected, but it can be connected later. If the external device is not connected to the HN, it can be added and connected anyway (however, it will be inactive while this device is physically connected to the HN)
--onboot – device will be connected to the container automatically after container startup; otherwise, it will be necessary to use the command to connect manually
--exclusive – without this option enabled, the device will be shared by the HN and one or many containers. Device sharing is a preferred forwarding mode, and it is used by default. Some hardware devices (e.g., disk drives, sound and video cards) cannot be shared, and have to be forwarded exclusively (requires device driver installation in the container)
2. Make sure the device appears in Device Manager of the container.
3. Install software that is going to use the USB device inside the container.
Other helpful parameters:
To connect a device to a container, the device must first be added:
vzdevctl connect 101 --alias “dev1”
To disconnect a device from a container:
vzdevctl dconnect 101 --alias “dev1”
For more options, run the "vzdevctl --help" command on the Hardware Node.