Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Oct 2003 23:05:52 -0500
From:      Jeffrey Lang <jrlang@jrlang.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Ubsa, Ucom and serial problems
Message-ID:  <OOEIILPNPMHDOEDFHMLECEAPCAAA.jrlang@jrlang.com>

next in thread | raw e-mail | index | archive | help
I have a FreeBSD-5.1 Stable system running on an Intel motherboard, P4,
2.4Ghz, 1G ram.  I'm trying to attach my APC UPS Backup Pro 1000 and 1100 to
this system to monitor them. One is attached to the serial port and the
other a Belkin F5U103 USB to serial adaptor. I'm using the latest version of
Network UPS Tool (NUT) to monitor them.

To verify the connection to both devices i use Tip which worked fine.

When nut is enable it works fine from the Serial port, but hangs when
accessing the belkin USB adaptor.

Having attached the USB device, i get a /dev/ucom0, as expected.  It appears
that nut hangs on the read to the device.  Writes seem to work ok.   I have
turned on driver debug and get the following traces:

>From Tip:

Oct  9 22:53:20 jrl5 kernel: ubsa0: ucomopen: tp = 0xc61fd200
Oct  9 22:53:20 jrl5 kernel: ucomparam: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:20 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:20 jrl5 kernel: ubsa_param: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: ubsa_baudrate: speed = 9600
Oct  9 22:53:20 jrl5 kernel: ubsa_parity: cflag = 0x4b00
Oct  9 22:53:20 jrl5 kernel: ubsa_databits: cflag = 0x4b00
Oct  9 22:53:20 jrl5 kernel: ubsa_stopbits: cflag = 0x4b00
Oct  9 22:53:20 jrl5 kernel: ubsa_flow: cflag = 0x4b00, iflag = 0x7
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomstartread: start
Oct  9 22:53:20 jrl5 kernel: ucomctl: bits = 0x6, how = 1
Oct  9 22:53:20 jrl5 kernel: ucom_dtr: onoff = 1
Oct  9 22:53:20 jrl5 kernel: ubsa_dtr: onoff = 1
Oct  9 22:53:20 jrl5 kernel: ucom_rts: onoff = 1
Oct  9 22:53:20 jrl5 kernel: ubsa_rts: onoff = 1
Oct  9 22:53:20 jrl5 kernel: ubsa_open: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: ucomopen: open pipes in = 129 out = 1
Oct  9 22:53:20 jrl5 kernel: ucomstartread: start
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ubsa0: ucomopen: success
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x402c7413
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x802c7416
Oct  9 22:53:20 jrl5 kernel: ucomstop: 1
Oct  9 22:53:20 jrl5 kernel: ucomstop: read
Oct  9 22:53:20 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:20 jrl5 kernel: ucomreadcb: status = 6
Oct  9 22:53:20 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:20 jrl5 kernel: ucomstop: done
Oct  9 22:53:20 jrl5 kernel: ucomparam: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x2000740d
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x402c7413
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x802c7416
Oct  9 22:53:20 jrl5 kernel: ucomstop: 1
Oct  9 22:53:20 jrl5 kernel: ucomstop: read
Oct  9 22:53:20 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:20 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:20 jrl5 kernel: ucomstop: done
Oct  9 22:53:20 jrl5 kernel: ucomparam: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:20 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:20 jrl5 kernel: ubsa_param: sc = 0xc60e4b00
Oct  9 22:53:20 jrl5 kernel: ubsa_baudrate: speed = 2400
Oct  9 22:53:20 jrl5 kernel: ubsa_parity: cflag = 0xcb00
Oct  9 22:53:20 jrl5 kernel: ubsa_databits: cflag = 0xcb00
Oct  9 22:53:20 jrl5 kernel: ubsa_stopbits: cflag = 0xcb00
Oct  9 22:53:20 jrl5 kernel: ubsa_flow: cflag = 0xcb00, iflag = 0x2e02
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomstartread: start
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x8004667e
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomioctl: cmd = 0x8004667d
Oct  9 22:53:20 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:20 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:53:20 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x20000
Oct  9 22:53:20 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:53:20 jrl5 kernel: ubsa_get_status
Oct  9 22:53:20 jrl5 kernel: ucom_status_change: DCD changed to 1
Oct  9 22:53:24 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x30001
Oct  9 22:53:24 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:24 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:53:24 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:53:24 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:53:24 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:53:24 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:24 jrl5 kernel: ucomreadcb: status = 0
Oct  9 22:53:24 jrl5 kernel: ucomreadcb: got 1 chars, tp = 0xc61fd200
Oct  9 22:53:24 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:24 jrl5 kernel: ucomstartread: start
Oct  9 22:53:24 jrl5 kernel: ucomread: error = 0
Oct  9 22:53:24 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x40000
Oct  9 22:53:24 jrl5 kernel: ucomreadcb: status = 0
Oct  9 22:53:24 jrl5 kernel: ucomreadcb: got 3 chars, tp = 0xc61fd200
Oct  9 22:53:24 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:24 jrl5 last message repeated 2 times
Oct  9 22:53:24 jrl5 kernel: ucomstartread: start
Oct  9 22:53:24 jrl5 kernel: ucomread: error = 0
Oct  9 22:53:24 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x50000
Oct  9 22:53:28 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x60001
Oct  9 22:53:28 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:28 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:53:28 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:53:28 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:53:28 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:53:28 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:28 jrl5 kernel: ucomreadcb: status = 0
Oct  9 22:53:28 jrl5 kernel: ucomreadcb: got 1 chars, tp = 0xc61fd200
Oct  9 22:53:28 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:28 jrl5 kernel: ucomstartread: start
Oct  9 22:53:28 jrl5 kernel: ucomread: error = 0
Oct  9 22:53:28 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x70000
Oct  9 22:53:28 jrl5 kernel: ucomreadcb: status = 0
Oct  9 22:53:28 jrl5 kernel: ucomreadcb: got 3 chars, tp = 0xc61fd200
Oct  9 22:53:28 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:53:28 jrl5 last message repeated 2 times
Oct  9 22:53:28 jrl5 kernel: ucomstartread: start
Oct  9 22:53:28 jrl5 kernel: ucomread: error = 0
Oct  9 22:53:28 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x80000
Oct  9 22:53:32 jrl5 kernel: ucomread: error = -1
Oct  9 22:53:32 jrl5 kernel: ubsa0: ucomclose: unit = 0
Oct  9 22:53:32 jrl5 kernel: ucomstop: 1
Oct  9 22:53:32 jrl5 kernel: ucomstop: read
Oct  9 22:53:32 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:32 jrl5 kernel: ucomreadcb: status = 6
Oct  9 22:53:32 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:32 jrl5 kernel: ucomstop: done
Oct  9 22:53:32 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:53:32 jrl5 kernel: ucomstop: 3
Oct  9 22:53:32 jrl5 kernel: ucomstop: read
Oct  9 22:53:32 jrl5 kernel: ucomstopread: enter
Oct  9 22:53:32 jrl5 kernel: ucomstopread: leave
Oct  9 22:53:32 jrl5 kernel: ucomstop: write
Oct  9 22:53:32 jrl5 kernel: ucomstop: done
Oct  9 22:53:32 jrl5 kernel: ucom_cleanup: closing pipes
Oct  9 22:53:32 jrl5 kernel: ucom_shutdown
Oct  9 22:53:32 jrl5 kernel: ucomctl: bits = 0x2, how = 2
Oct  9 22:53:32 jrl5 kernel: ucom_dtr: onoff = 0
Oct  9 22:53:32 jrl5 kernel: ubsa_dtr: onoff = 0
Oct  9 22:53:32 jrl5 kernel: ucom_rts: onoff = 1
Oct  9 22:53:32 jrl5 kernel: ubsa_rts: onoff = 1
Oct  9 22:53:32 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x18
Oct  9 22:53:32 jrl5 kernel: ubsa_get_status
Oct  9 22:53:32 jrl5 kernel: ucom_status_change: DCD changed to 0
Oct  9 22:53:32 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x10
Oct  9 22:53:32 jrl5 kernel: ubsa_get_status
Oct  9 22:53:33 jrl5 kernel: ubsa_close: close

>From Nut:

Oct  9 22:54:23 jrl5 kernel: ubsa0: ucomopen: tp = 0xc61fd200
Oct  9 22:54:23 jrl5 kernel: ucomparam: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:23 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:23 jrl5 kernel: ubsa_param: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_baudrate: speed = 9600
Oct  9 22:54:23 jrl5 kernel: ubsa_parity: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_databits: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_stopbits: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_flow: cflag = 0x4b00, iflag = 0x7
Oct  9 22:54:23 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomstartread: start
Oct  9 22:54:23 jrl5 kernel: ucomctl: bits = 0x6, how = 1
Oct  9 22:54:23 jrl5 kernel: ucom_dtr: onoff = 1
Oct  9 22:54:23 jrl5 kernel: ubsa_dtr: onoff = 1
Oct  9 22:54:23 jrl5 kernel: ucom_rts: onoff = 1
Oct  9 22:54:23 jrl5 kernel: ubsa_rts: onoff = 1
Oct  9 22:54:23 jrl5 kernel: ubsa_open: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ucomopen: open pipes in = 129 out = 1
Oct  9 22:54:23 jrl5 kernel: ucomstartread: start
Oct  9 22:54:23 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ubsa0: ucomopen: success
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x8004667e
Oct  9 22:54:23 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x8004667d
Oct  9 22:54:23 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x402c7413
Oct  9 22:54:23 jrl5 kernel: disc_optim: can't bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x802c7414
Oct  9 22:54:23 jrl5 kernel: ucomparam: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:23 jrl5 kernel: ucomreadcb: status = 6
Oct  9 22:54:23 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:23 jrl5 kernel: ubsa_param: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_baudrate: speed = 2400
Oct  9 22:54:23 jrl5 kernel: ubsa_parity: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_databits: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_stopbits: cflag = 0x4b00
Oct  9 22:54:23 jrl5 kernel: ubsa_flow: cflag = 0x4b00, iflag = 0x801
Oct  9 22:54:23 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomstartread: start
Oct  9 22:54:23 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:23 jrl5 kernel: ucomstop: 1
Oct  9 22:54:23 jrl5 kernel: ucomstop: read
Oct  9 22:54:23 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:23 jrl5 kernel: ucomreadcb: status = 6
Oct  9 22:54:23 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:23 jrl5 kernel: ucomstop: done
Oct  9 22:54:23 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:23 jrl5 kernel: ucomstop: 1
Oct  9 22:54:23 jrl5 kernel: ucomstop: read
Oct  9 22:54:23 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:23 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:23 jrl5 kernel: ucomstop: done
Oct  9 22:54:23 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:23 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x20001
Oct  9 22:54:23 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:23 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:23 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:23 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:23 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:23 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:24 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:54:24 jrl5 kernel: ubsa_get_status
Oct  9 22:54:24 jrl5 kernel: ucom_status_change: DCD changed to 1
Oct  9 22:54:25 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x30000
Oct  9 22:54:28 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:29 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:29 jrl5 kernel: ucomstop: 1
Oct  9 22:54:29 jrl5 kernel: ucomstop: read
Oct  9 22:54:29 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:29 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:29 jrl5 kernel: ucomstop: done
Oct  9 22:54:29 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:29 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:29 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x40001
Oct  9 22:54:29 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:29 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:29 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:29 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x50000
Oct  9 22:54:29 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:29 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:29 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:32 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:32 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:32 jrl5 kernel: ucomstop: 1
Oct  9 22:54:32 jrl5 kernel: ucomstop: read
Oct  9 22:54:32 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:32 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:32 jrl5 kernel: ucomstop: done
Oct  9 22:54:32 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:32 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:32 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x60001
Oct  9 22:54:32 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:32 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:32 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:32 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:32 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:32 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:33 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x70000
Oct  9 22:54:36 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:37 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:37 jrl5 kernel: ucomstop: 1
Oct  9 22:54:37 jrl5 kernel: ucomstop: read
Oct  9 22:54:37 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:37 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:37 jrl5 kernel: ucomstop: done
Oct  9 22:54:37 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:37 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:37 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x80001
Oct  9 22:54:37 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:37 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:37 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:37 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x90000
Oct  9 22:54:37 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:37 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:37 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:40 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:40 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:40 jrl5 kernel: ucomstop: 1
Oct  9 22:54:40 jrl5 kernel: ucomstop: read
Oct  9 22:54:40 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:40 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:40 jrl5 kernel: ucomstop: done
Oct  9 22:54:40 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:40 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:40 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0xa0001
Oct  9 22:54:40 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:40 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:40 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:40 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:40 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:40 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:40 jrl5 kernel: ubsa0: ubsa lsr = 0x61, msr = 0x90
Oct  9 22:54:40 jrl5 kernel: ubsa_get_status
Oct  9 22:54:40 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:54:40 jrl5 kernel: ubsa_get_status
Oct  9 22:54:41 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0xb0000
Oct  9 22:54:44 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:45 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:45 jrl5 kernel: ucomstop: 1
Oct  9 22:54:45 jrl5 kernel: ucomstop: read
Oct  9 22:54:45 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:45 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:45 jrl5 kernel: ucomstop: done
Oct  9 22:54:45 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:45 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:45 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0xc0001
Oct  9 22:54:45 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:45 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:45 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:45 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0xd0000
Oct  9 22:54:45 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:45 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:45 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:48 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:48 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:48 jrl5 kernel: ucomstop: 1
Oct  9 22:54:48 jrl5 kernel: ucomstop: read
Oct  9 22:54:48 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:48 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:48 jrl5 kernel: ucomstop: done
Oct  9 22:54:48 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:48 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:48 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0xe0001
Oct  9 22:54:48 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:48 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:48 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:48 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:48 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:48 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:48 jrl5 kernel: ubsa0: ubsa lsr = 0x61, msr = 0x90
Oct  9 22:54:48 jrl5 kernel: ubsa_get_status
Oct  9 22:54:48 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:54:48 jrl5 kernel: ubsa_get_status
Oct  9 22:54:49 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0xf0000
Oct  9 22:54:52 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:53 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:53 jrl5 kernel: ucomstop: 1
Oct  9 22:54:53 jrl5 kernel: ucomstop: read
Oct  9 22:54:53 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:53 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:53 jrl5 kernel: ucomstop: done
Oct  9 22:54:53 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:53 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:53 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x100001
Oct  9 22:54:53 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:53 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:53 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:53 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x110000
Oct  9 22:54:53 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:53 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:53 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:53 jrl5 kernel: ubsa0: ubsa lsr = 0x61, msr = 0x90
Oct  9 22:54:53 jrl5 kernel: ubsa_get_status
Oct  9 22:54:53 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:54:53 jrl5 kernel: ubsa_get_status
Oct  9 22:54:56 jrl5 kernel: ucomread: error = 4
Oct  9 22:54:56 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:54:56 jrl5 kernel: ucomstop: 1
Oct  9 22:54:56 jrl5 kernel: ucomstop: read
Oct  9 22:54:56 jrl5 kernel: ucomstopread: enter
Oct  9 22:54:56 jrl5 kernel: ucomstopread: leave
Oct  9 22:54:56 jrl5 kernel: ucomstop: done
Oct  9 22:54:56 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:54:56 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:54:56 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x120001
Oct  9 22:54:56 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:56 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:54:56 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:54:56 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:54:56 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:54:56 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:54:57 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x130000
Oct  9 22:55:00 jrl5 kernel: ucomread: error = 4
Oct  9 22:55:01 jrl5 kernel: ucomioctl: cmd = 0x80047410
Oct  9 22:55:01 jrl5 kernel: ucomstop: 1
Oct  9 22:55:01 jrl5 kernel: ucomstop: read
Oct  9 22:55:01 jrl5 kernel: ucomstopread: enter
Oct  9 22:55:01 jrl5 kernel: ucomstopread: leave
Oct  9 22:55:01 jrl5 kernel: ucomstop: done
Oct  9 22:55:01 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:55:01 jrl5 kernel: ucomioctl: ttioctl: error = 0
Oct  9 22:55:01 jrl5 kernel: ucomwrite: tp = 0xc61fd200, flag = 0x140001
Oct  9 22:55:01 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:55:01 jrl5 kernel: ucomstart: 1 chars
Oct  9 22:55:01 jrl5 kernel: ucomwrite: error = 0
Oct  9 22:55:01 jrl5 kernel: ucomread: tp = 0xc61fd200, flag = 0x150000
Oct  9 22:55:01 jrl5 kernel: ucomwritecb: status = 0
Oct  9 22:55:01 jrl5 kernel: ucomwritecb: cc = 1
Oct  9 22:55:01 jrl5 kernel: ucomstart: sc = 0xc60e4b00
Oct  9 22:55:01 jrl5 kernel: ubsa0: ubsa lsr = 0x61, msr = 0x90
Oct  9 22:55:01 jrl5 kernel: ubsa_get_status
Oct  9 22:55:01 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x90
Oct  9 22:55:01 jrl5 kernel: ubsa_get_status
Oct  9 22:55:04 jrl5 kernel: ucomread: error = 4
Oct  9 22:55:04 jrl5 kernel: ubsa0: ucomclose: unit = 0
Oct  9 22:55:04 jrl5 kernel: ucomstop: 1
Oct  9 22:55:04 jrl5 kernel: ucomstop: read
Oct  9 22:55:04 jrl5 kernel: ucomstopread: enter
Oct  9 22:55:04 jrl5 kernel: ucomstopread: leave
Oct  9 22:55:04 jrl5 kernel: ucomstop: done
Oct  9 22:55:04 jrl5 kernel: disc_optim: bypass l_rint
Oct  9 22:55:04 jrl5 kernel: ucomstop: 3
Oct  9 22:55:04 jrl5 kernel: ucomstop: read
Oct  9 22:55:04 jrl5 kernel: ucomstopread: enter
Oct  9 22:55:04 jrl5 kernel: ucomstopread: leave
Oct  9 22:55:04 jrl5 kernel: ucomstop: write
Oct  9 22:55:04 jrl5 kernel: ucomstop: done
Oct  9 22:55:04 jrl5 kernel: ucom_cleanup: closing pipes
Oct  9 22:55:04 jrl5 kernel: ucom_shutdown
Oct  9 22:55:04 jrl5 kernel: ucomctl: bits = 0x2, how = 2
Oct  9 22:55:04 jrl5 kernel: ucom_dtr: onoff = 0
Oct  9 22:55:04 jrl5 kernel: ubsa_dtr: onoff = 0
Oct  9 22:55:04 jrl5 kernel: ucom_rts: onoff = 1
Oct  9 22:55:04 jrl5 kernel: ubsa_rts: onoff = 1
Oct  9 22:55:04 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x18
Oct  9 22:55:04 jrl5 kernel: ubsa_get_status
Oct  9 22:55:04 jrl5 kernel: ucom_status_change: DCD changed to 0
Oct  9 22:55:04 jrl5 kernel: ubsa0: ubsa lsr = 0x60, msr = 0x10
Oct  9 22:55:04 jrl5 kernel: ubsa_get_status
Oct  9 22:55:05 jrl5 kernel: ubsa_close: close

I wrote a test case to see if i could figure out what the difference was
between what tip and nut was doing.  see below:

#include <sys/types.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/ioctl.h>

#include <termios.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <ctype.h>
#include <setjmp.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>

static int	FD;	/* open file descriptor */
static char	*cp="/dev/ucom0";
static int	deadfl = 0;
int DC = 1;
int TAND = 1;

void ttysetup();
main() {
	int status;
	char buf[20];

	FD = open(cp, (O_RDWR | O_NONBLOCK ));
	if (FD < 0) {
		perror(cp);
		deadfl = 1;
	}

	if (!deadfl) {
		struct termios cntrl;
		tcgetattr(FD, &cntrl);
		if (!DC)
			cntrl.c_cflag |= HUPCL;
		tcsetattr(FD, TCSAFLUSH, &cntrl);
		ioctl(FD, TIOCEXCL, 0);
	} else {
		perror(cp);
		exit(-1);
	}

	ttysetup(B2400);

	printf("Before write\n");
	status = write(FD, "Y\n", 2);
	if (status < 0) {
		perror(cp);
		exit(-2);
	}

	sleep(1);
	printf("Before read\n");
	status = read(FD, buf, 15);
	if (status < 0) {
		perror(cp);
		exit(-2);
	}

	printf("RECV: %s\n", buf);

	close(FD);
}

/*
 * Set up the "remote" tty's state
 */
void
ttysetup(speed)
        int speed;
{
        struct termios  cntrl;

        tcgetattr(FD, &cntrl);
        cfsetospeed(&cntrl, speed);
        cfsetispeed(&cntrl, speed);
        cntrl.c_cflag &= ~(CSIZE|PARENB);
        cntrl.c_cflag |= CS8;
        if (DC)
                cntrl.c_cflag |= CLOCAL;
        cntrl.c_iflag &= ~(ISTRIP|ICRNL);
        cntrl.c_oflag &= ~OPOST;
        cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);
        cntrl.c_cc[VMIN] = 1;
        cntrl.c_cc[VTIME] = 0;
        if (TAND)
                cntrl.c_iflag |= IXOFF;
        tcsetattr(FD, TCSAFLUSH, &cntrl);
}


This program kept returning an error code 35, "Resource Temporairaly
Unabailable" message until i added the "sleep" line before the read then it
worked fine.

Ok, so my question is this, why would the system hang on reads to the
device?
When tip works fine.  What could be the coding difference that would cause
this to happen?

Any help on this would be helpful!

Also,   is there any good documentation on the USB subsystem and how it is
designed and put together?

thanks
jeff





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OOEIILPNPMHDOEDFHMLECEAPCAAA.jrlang>