# Serial & USB ports



## jailed (Jul 22, 2010)

Hello,

First of all, I'm using FreeBSD 8.0

I read the manual and think that serial port belongs to sioX. I have scanned all my computers and can't see any sio in dmesg. Then I realized that, serial port may belong to uartX. Because the irq values seem to be same.

On machines acpi disables, I can't even see uart.


```
# dmesg | grep uart
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
```

Can you please tell me this is correct or not? Is uart0, serial port?

I also can't find any /dev/ttyd*

In my C codes I think I must use 0x3f8 address to communicate my devices.

So what about /dev devices? There is no /dev/uart0. Can you tell me how can I find the serial port in /dev ?

Second question about usb. when I do dmesg | grep usb, I can't see machine address of usb ports. As 0x378 (paralel port). Can I communicate over usb with standard inb, outb functions? Or is there any other method (system calls, other functions, etc.) Can you give me a resource about programming usb in C.

Thank you.


----------



## DutchDaemon (Jul 22, 2010)

/usr/src/sys/*/conf/GENERIC:


```
# Serial (COM) ports
device          uart            # Generic UART driver
```

/usr/src/sys/*/conf/GENERIC.hints:

```
hint.uart.0.at="isa"
hint.uart.0.port="[B]0x3F8[/B]"
hint.uart.0.flags="0x10"
hint.uart.0.irq="4"
hint.uart.1.at="isa"
hint.uart.1.port="0x2F8"
hint.uart.1.irq="3"
```


----------



## kpa (Jul 22, 2010)

Usb(4) manual page:
http://www.freebsd.org/cgi/man.cgi?query=usb&apropos=0&sektion=4&manpath=FreeBSD+8.0-RELEASE&format=html


----------



## wblock@ (Jul 22, 2010)

jailed said:
			
		

> So what about /dev devices? There is no /dev/uart0. Can you tell me how can I find the serial port in /dev ?



A real serial port will show up as /dev/cuau0.  After you've loaded ucom.ko, a USB-to-serial adapter will show up as /dev/cuaU0.


----------



## jailed (Jul 22, 2010)

kpa said:
			
		

> Usb(4) manual page:
> http://www.freebsd.org/cgi/man.cgi?query=usb&apropos=0&sektion=4&manpath=FreeBSD+8.0-RELEASE&format=html



I found libusb link on the page you gave, and that's the answer of my usb programming question.

http://www.freebsd.org/cgi/man.cgi?query=libusb&sektion=3&apropos=0&manpath=FreeBSD+8.0-RELEASE

Thank you.


----------



## jailed (Jul 22, 2010)

wblock said:
			
		

> A real serial port will show up as /dev/cuau0.  After you've loaded ucom.ko, a USB-to-serial adapter will show up as /dev/cuaU0.



Thank you very very much. /dev/cuau0 is the right port. And my device has been worked.

This tip saved my life. Thank you.


----------

