usb thermometer - TEMPer - FreeBSD

Torfinn Ingolfsen torfinn.ingolfsen at broadpark.no
Mon Dec 28 01:01:09 UTC 2009


On Tue, 03 Nov 2009 22:56:57 +0100
Hans Petter Selasky <hselasky at c2i.net> wrote:

> On Tuesday 03 November 2009 22:27:03 Torfinn Ingolfsen wrote:
> > But where is ucom0?
> > root at kg-t2# ls -l /dev/uc*
> > ls: /dev/uc*: No such file or directory
> > root at kg-t2# ls -l /dev/ucom0
> > ls: /dev/ucom0: No such file or directory
> > root at kg-t2# ls -l /dev/ucom0
> 
> /dev/cuaU0

Ok, I have done some more testing with the TEMPer. I have kldloaded uchcom.
root at testhost-1# uname -a
FreeBSD testhost-1.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #0: Sat Dec 12 23:49:41 CET 2009     root at testhost-1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
In /var/log/messages:
Dec 27 23:07:43 testhost-1 kernel: ugen1.2: <vendor 0x4348> at usbus1
Dec 27 23:07:43 testhost-1 kernel: ucom0: <vendor 0x4348 USB-SER!, rev 1.10/2.50, addr 2> on usbus1
Dec 27 23:07:43 testhost-1 kernel: ucom0: CH340 detected
I took TEMPer.c[1] from Tollef Fog Heen's site, changed the device from /dev/ttyUSB0 to /dev/ttyU0 and compiled with

gcc -lm -o TEMPer2 TEMPer2.c

and tested it:
root at testhost-1# ./TEMPer2
Init starting
Init done
^Croot at testhost-1#
It hangs after "Init done" until I break out of it with Ctrl-C. This is strange, the same code works fine un Linux:
tingo at kg-home:~$ uname -a
Linux kg-home 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:01:29 UTC 2009 i686 GNU/Linux
tingo at kg-home:~$ ~/work/temper/TEMPer
Init starting
Init done
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100100000000. 25.000000
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100000000000. 24.000000
Getting temperature done 0001100000000000. 24.000000
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100010000000. 24.500000
Getting temperature done 0001100100000000. 25.000000
^C

I wonder if it is the driver in FreeBSD or something different in the tty initialization?
Anyway, I have made a FreeBSD[2] and  a Linux[3] page with all the details.

References:
1) http://err.no/src/TEMPer.c
2) http://sites.google.com/site/tingox/temper_freebsd
3) http://sites.google.com/site/tingox/temper_xubuntu
-- 
Regards,
Torfinn Ingolfsen



More information about the freebsd-usb mailing list