code: func (l VirtualDeviceList) ConnectSerialPort(device *types.VirtualSerialPort, uri string, client bool, proxyuri string) *types.VirtualSerialPort {
  	if strings.HasPrefix(uri, "[") {
  		device.Backing = &types.VirtualSerialPortFileBackingInfo{
  			VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{
  				FileName: uri,
  			},
  		}
  
  		return device
  	}
  
  	direction := types.VirtualDeviceURIBackingOptionDirectionServer
  	if client {
  		direction = types.VirtualDeviceURIBackingOptionDirectionClient
  	}
  
  	device.Backing = &types.VirtualSerialPortURIBackingInfo{
  		VirtualDeviceURIBackingInfo: types.VirtualDeviceURIBackingInfo{
  			Direction:  string(direction),
  			ServiceURI: uri,
  			ProxyURI:   proxyuri,
  		},
  	}
  
  	return device
  }
docs: // ConnectSerialPort connects a serial port to a server or client uri.