#Configure the USB serial port adapters

###Insert one device at a time on a USB port:

	$ lsusb

With the following command we will see __idProduct__ and __idVendor__ of each connected device.

Result:

	Bus 001 Device 009: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
	Bus 001 Device 008: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
	Bus 001 Device 007: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
	Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
	Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

__ID 0403:6001__ the first number is __idVendor__ and the second is __idProduct__.

###With this command you can see on which number of ports is connected:

	$ lsusb -t
	
Result:	

	/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
	    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
	        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
	        |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M

###Now we want port 2 for example to become __/dev/ttyS1__:

	$ sudo nano /etc/udev/rules.d/99-usb-serial.rules

Insert the following instruction:

	# -----------------------------------------------------------------------
	# Fix USB serial port
	# -----------------------------------------------------------------------
	
	# /dev/ttyS1 serial TTL
	ATTRS{devpath}=="1.2", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS1", GROUP="dialout", MODE="0666"

Eventually, once the device is connected to the USB port, we will have a serial communication port called __/dev/ttyS1__.

If we have 2 adapters with the same __idVendor__ and __idProduct__, we can fix the device on that specific USB port:

	$ lsusb -t
	
Result:

	/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
	    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
	        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
	        |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
	        |__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
	        |__ Port 4: Dev 9, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M

###Edit file:

	$ sudo nano /etc/udev/rules.d/99-usb-serial.rules
	
Result:

	# -----------------------------------------------------------------------
	# Fix USB serial port
	# -----------------------------------------------------------------------
	
	# /dev/ttyS1 serial TTL
	ATTRS{devpath}=="1.2", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS1", GROUP="dialout", MODE="0666"
	
	# /dev/ttyS2 serial TTL
	ATTRS{devpath}=="1.3", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS2", GROUP="dialout", MODE="0666"






