V práci se potřebuji připojovat k SUNovským mašinkám a jině verbeži přes sériový port, protože nemám na notebooku seriový port od výrobce, musel jsem použít redukci USB-RS232. Redukci jsem kupoval na posledni chvíli a vůbec jsem netušil jaký chip na sobě má. Měl jsem štěstí, je na ní FTDI. Pro její funkci v Linuxu 2.6 je potřeba modul ftdi_sio.
Výpis dmesg po natažení modulu do jádra:
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI SIO drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI 8U232AM Compatible drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI FT232BM Compatible drivers/usb/serial/usb-serial.c: USB Serial support registered for USB-UIRT Infrared Tranceiver drivers/usb/serial/usb-serial.c: USB Serial support registered for Home-Electronics TIRA-1 IR Transceiver usbcore: registered new driver ftdi_sio drivers/usb/serial/ftdi_sio.c: v1.4.0:USB FTDI Serial Converters Driver
Po zasunutí redukce do USB se v dmesg objeví tento výpis:
uhci_hcd 0000:00:1d.1: port 2 portsc 0093 hub 2-0:1.0: port 2, status 0101, change 0001, 12 Mb/s hub 2-0:1.0: debounce: port 2: delay 100ms stable 4 status 0x101 usb 2-2: new full speed USB device using address 3 usb 2-2: new device strings: Mfr=1, Product=2, SerialNumber=0 usb 2-2: default language 0x0409 usb 2-2: Product: USB <-> Serial usb 2-2: Manufacturer: FTDI usb 2-2: hotplug usb 2-2: adding 2-2:1.0 (config #1, interface 0) usb 2-2:1.0: hotplug usbserial 2-2:1.0: usb_probe_interface usbserial 2-2:1.0: usb_probe_interface - got id usbserial 2-2:1.0: FTDI FT232BM Compatible converter detected usb 2-2: FTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
Redukce je také vidět ve výpisu lsusb:
Bus 002 Device 003: ID 0403:6001 Future Technology Devices Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 Interface bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0403 Future Technology Devices idProduct 0x6001 bcdDevice 4.00 iManufacturer 1 FTDI iProduct 2 USB <-> Serial iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 MaxPower 90mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 2 USB <-> Serial Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type none wMaxPacketSize 64 bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type none wMaxPacketSize 64 bInterval 0 Language IDs: (length=4) 0409 English(US)
Komunikační program
Pro komunikaci po sériovém portu používám program minicom. Umístění konfiguračních souborů minicomu se liší v závislosti na distribuci Linuxu. Ve Slackware je to /etc/minirc.dfl v Debianu je to v adresáři /etc/minicom. Mé nastavení pro připojení přez redukci na USB je takovéto:
pr port /dev/ttyUSB0 pu baudrate 38400 pu bits 8 pu parity N pu stopbits 1 pu minit pu mreset pu backspace DEL pu rtscts No
Comments are closed.