簡単な室温補正を必要とする測定のために温度計を探してみたのですが、
http://www.pcsensor.comindex.php_a=product&product_id=41 が FreeBSD-8.4 でも使えるようです。国内でも、 http://www.donya.jp/item/24167.html とか amazon などで取扱があって、1,000 円ちょっとで入手できます。 デバイスそのものは、Hid として設計されていて、 usbconfig dump_device_desc の結果は下記のようになります。 ugen0.2: <TEMPerV1.4 RDing> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0008 idVendor = 0x0c45 idProduct = 0x7401 bcdDevice = 0x0001 iManufacturer = 0x0001 <RDing> iProduct = 0x0002 <TEMPerV1.4> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001 付属 CD-ROM には Windows のアプリケーションしかありませんが、 Linux community で開発された pcsensor-1.0.0-multi.tgz が http://momtchil.momtchev.com/node/6 にありますので、これに下記のパッチをあてて、make すれば、 FreeBSD-8.4 で動作する pcsensor ができます。 --- pcsensor.c.orig 2013-12-11 09:10:15.000000000 +0900 +++ pcsensor.c 2013-12-11 09:19:40.000000000 +0900 @@ -34,8 +34,13 @@ #include <string.h> #include <errno.h> #include <signal.h> - - +#ifdef __FreeBSD__ +#include <stdlib.h> +#include <unistd.h> +#include <libusb.h> +#endif + + #define VERSION "1.0.0" #define VENDOR_ID 0x0c45 @@ -80,17 +85,21 @@ ret = usb_detach_kernel_driver_np(lvr_winusb, iInterface); if(ret) { +#ifndef __FreeBSD__ if(errno == ENODATA) { if(debug) { printf("Device already detached\n"); } } else { +#endif if(debug) { printf("Detach failed: %s[%d]\n", strerror(errno), errno); printf("Continuing anyway\n"); } +#ifndef __FreeBSD__ } +#endif } else { if(debug) { printf("detach successful\n"); --- Makefile 2013-12-10 17:19:15.000000000 +0900 +++ makefile 2013-12-11 09:07:53.000000000 +0900 @@ -3,10 +3,9 @@ CFLAGS = -O2 -Wall pcsensor: pcsensor.c - ${CC} -DUNIT_TEST -o $@ $^ -lusb + cc -g -o pcsensor pcsensor.c -lusb + chmod 4755 pcsensor + chown root pcsensor clean: - rm -f pcsensor *.o - -rules-install: # must be superuser to do this - cp 99-tempsensor.rules /etc/udev/rules.d + rm -f pcsensor --< cut >-- このプログラム(pcsensor)を実行すると、下記のような出力が得られます。 $ pcsensor 2013/12/11 09:50:08 Temperature 72.05F 22.25C 短いプログラムですから、自分がほしい機能に書き換えるのも簡単です。 なお、このプログラムは libusb(http://www.libusb.org/) の 0.1 を使 っていて、既に legacy 版ですが、FreeBSD-8.4 ではまだ使えるものの、 まともなマニュアルがありませんので、libusb については、 http://libusb.sourceforge.net/doc/ を参照してください。現行版 1.0 のマニュアルは http://libusb.sourceforge.net/api-1.0/ です。 平林 浩一 _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-users-jp To unsubscribe, send any mail to "[email protected]"
