OpenWrt Forum Archive

Topic: 'TEMPer' USB thermometer with openwrt

The content of this topic has been archived between 17 Apr 2018 and 1 May 2018. Unfortunately there are posts – most likely complete pages – missing.

I need to find something I can compile on a workstation, then copy the binaries over to the tp-link.
Thought I had it with the link you sent me but that didn't work.

Anyone know how I can check to know if the USB port is alive? I think my build is disabling the USB port because connecting anything to it shows no activity.

# opkg list-installed | grep usb
kmod-usb-core - 3.10.49-1
kmod-usb2 - 3.10.49-1

Looks like I should be seeing;

# opkg list-installed | grep usb
kmod-ledtrig-usbdev - 3.6.11-1
kmod-usb-core - 3.6.11-1
kmod-usb-ohci - 3.6.11-1
kmod-usb2 - 3.6.11-1

I tried adding the missing packages but still nothing.

UPDATE: Oh, actually, I do see this;

[ 1889.150000] usb 1-1: new high-speed USB device number 4 using ehci-platform (plugged in usb stick)
[ 1948.910000] usb 1-1: USB disconnect, device number 4 (took usb stick out)
[ 1961.930000] hub 1-0:1.0: connect-debounce failed, port 1 disabled (plugged in TEMPer)

Guessing my TEMPer units are USB 1.0 because from what I've read, these devices have USB 2.0.

UPDATE: Fix was to connect a USB 2.0 HUB to the TP-LINK then connect the USB 1.0 device to the hub and now the TP-LINK can see the TEMPer device.

Doesn't help since I don't have any software for it yet smile

(Last edited by projects on 2 Dec 2014, 15:46)

Can anyone compile then perhaps share the resulting binaries?

Here's your recipe to compile temper for 1130:660c:

cd ~/openwrt/14.07/package/utils/
wget --no-check-certificate https://dev.openwrt.org/raw-attachment/ticket/10577/temper.zip
unzip temper.zip
cd temper/
edit Makefile, change DEPENDS:=+libusb -> DEPENDS:=+libusb-compat
cd ~/openwrt/14.07/
make package/temper/{clean,prepare,compile} V=s
-> find your temper package in bin/ar71xx/packages/base/temper_1_ar71xx.ipk

Installed on a DIR-505-1 and tested (yet w/o any TEMPer devices attached):

root@DIR-505-1:~# temper
Found device: 1a40:0101
Found device: 1d6b:0002
Found device: 0781:5571
Found device: 046d:082d
TemperCreate: Success
root@DIR-505-1:~# lsusb
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 004: ID 046d:082d Logitech, Inc. HD Pro Webcam C920

Please keep in mind that this version only works for

VENDOR_ID  0x1130
PRODUCT_ID 0x660c

(see temper.c)

Edit:
For info: $software out there on the net supports 0c45:7401; 0c45:7402; 1130:660c
-> please check VID:PID of your device

(Last edited by tmo26 on 30 Jul 2015, 18:27)

TEMPer2 (https://github.com/s-leroux/TEMPer2) which supports (0c45:7401; 0c45:7402) is a bit more complicated to compile. I'm currently stuck at:

cp -fpR /home/tmomas/openwrt/14.07/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libssp.so.* /home/tmomas/openwrt/14.07/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ipkg-ar71xx/libssp/lib/
cp: cannot stat `/home/tmomas/openwrt/14.07/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libssp.so.*': No such file or directory

Although ssp support is selected in the toolchain options and also libssp, I'm getting the above error.
No clue...

cd ~/openwrt/14.07/package/utils/
wget --no-check-certificate https://dev.openwrt.org/raw-attachment/ticket/10577/temper.zip
unzip temper.zip
cd temper/
edit Makefile, change DEPENDS:=+libusb -> DEPENDS:=+libusb-compat
cd ~/openwrt/14.07/
make package/temper/{clean,prepare,compile} V=s
-> find your temper package in bin/ar71xx/packages/base/temper_1_ar71xx.ipk

<sigh>

$ make package/temper/{clean,prepare,compile} V=s
Collecting package info: done
make[1]: Entering directory `/clients/openwrt'
make[1]: *** No rule to make target `package/temper/{clean,prepare,compile}'.  Stop.
make[1]: Leaving directory `/clients/openwrt'
make: *** [package/temper/{clean,prepare,compile}] Error 2

- Did you issue the make command in the right directory? (That's where you do make menuconfig)
- Are the Makefile and the src in the right directory? -> ls -l /clients/openwrt/package/utils/temper

Yup, well, I think so.
My setup is;

/clients/openwrt

The TEMPer source is package/utils/temper

$ ls -la package/utils/temper
total 16
drwxr-xr-x  3 nobody nogroup 4096 Dec  4 16:15 .
drwxr-xr-x 25 nobody nogroup 4096 Dec  4 13:27 ..
-rw-r--r--  1 nobody nogroup  553 Dec  4 16:15 Makefile
drwxr-xr-x  2 nobody nogroup 4096 Dec  1 14:17 src

I issued the command from /clients/openwrt after editing the code;

$ make package/temper/{clean,prepare,compile} V=s
Collecting package info: done
make[1]: Entering directory `/clients/openwrt'
make[1]: *** No rule to make target `package/temper/{clean,prepare,compile}'.  Stop.
make[1]: Leaving directory `/clients/openwrt'
make: *** [package/temper/{clean,prepare,compile}] Error 2

Just guessing:

make menuconfig, exit and save if asked
make package/temper/{clean,prepare,compile} V=s

Used make menuconfig, saved using ar71xx. Then ran make to get the new build using the right type.
Then I'll run the TEMPer code again.

Guess this means I can use the same build for different hardware but need to run the long long long slow slow slow make process each time I change types uh?

Why is this not working? I've followed exactly the directions you've given me. It's working for you?

IMHO it would be better to create an openwrt Makefile, rather than doing it "by hand" (via his scripts).
But I'm not really the one to judge in this case, given my limited knowledge about compiling.

It did create a temper and usbtemp file but neither one runs on the tp-link.
I think I'll have to give up because I am spending too much time on this. I would really love to be able to read external temps however, that would be a neat function.

projects wrote:

Why is this not working? I've followed exactly the directions you've given me. It's working for you?

Yep, it's working for me, just re-checked that (the build of the package; temper hardware *still* not arrived, although I ordered them already on monday! What takes them so long from china to europe?-)

In your build directory (/clients/openwrt), do

grep temper .config
grep compat .config
ls -lR /clients/openwrt/package/utils/temper

CLUES!!!!

# grep temper .config
# CONFIG_PACKAGE_temper is not set

# grep compat .config
# CONFIG_PACKAGE_kmod-ipt-compat-xtables is not set
# CONFIG_PACKAGE_libavahi-compat-libdnssd is not set
# CONFIG_PACKAGE_libusb-compat is not set

# ls -lR /clients/openwrt/package/utils/temper
/clients/openwrt/package/utils/temper:
total 8
-rw-r--r-- 1 nobody nogroup  553 Dec  5 13:36 Makefile
drwxr-xr-x 2 nobody nogroup 4096 Dec  5 13:48 src

/clients/openwrt/package/utils/temper/src:
total 20
-rw-r--r-- 1 nobody nogroup  133 Dec 10  2011 Makefile
-rw-r--r-- 1 nobody nogroup 6278 Dec 10  2011 temper.c
-rw-r--r-- 1 nobody nogroup 1634 Dec 10  2011 temper.h
-rw-r--r-- 1 nobody nogroup 2011 Dec 10  2011 usbtemp.c

So... I'm missing a step?

(Last edited by projects on 6 Dec 2014, 00:54)

I missed a step in my above recipe: make menuconfig -> select temper (M) and libusb-compat (M), exit and save your config

Complete recipe:

cd ~/openwrt/14.07/package/utils/
wget --no-check-certificate https://dev.openwrt.org/raw-attachment/ticket/10577/temper.zip
unzip temper.zip
cd temper/
edit Makefile, change DEPENDS:=+libusb -> DEPENDS:=+libusb-compat
cd ~/openwrt/14.07/
make menuconfig -> select temper (M) and libusb-compat (M), exit and save your config
make package/temper/{clean,prepare,compile} V=s
-> find your temper package in bin/ar71xx/packages/base/temper_1_ar71xx.ipk

Give it a try.

I did exactly as you suggested, make menuconfig, made sure temper and the usblib were included. Ran make however, before running the make for temper only. Maybe that's where I went wrong?

$ make package/temper/{clean,prepare,compile} V=s
make[1]: Entering directory `/clients/openwrt'
make[1]: *** No rule to make target `package/temper/{clean,prepare,compile}'.  Stop.
make[1]: Leaving directory `/clients/openwrt'
make: *** [package/temper/{clean,prepare,compile}] Error 2
$ exit

I then looked in the bin directory just for the heck of it and found the package.
Copied it to the tplink and tried installing it;

# opkg install temper_1_ar71xx.ipk
Installing temper (1) to root...
Installing libusb-compat (0.1.4-1) to root...
Downloading http://downloads.openwrt.org/barrier_br … r71xx.ipk.
Installing libusb-1.0 (1.0.9-1) to root...
Downloading http://downloads.openwrt.org/barrier_br … r71xx.ipk.
Installing libpthread (0.9.33.2-1) to root...
Downloading http://downloads.openwrt.org/barrier_br … r71xx.ipk.
Installing librt (0.9.33.2-1) to root...
Downloading http://downloads.openwrt.org/barrier_br … r71xx.ipk.
Configuring libpthread.
Configuring librt.
Configuring libusb-1.0.
Configuring libusb-compat.
Configuring temper.
//usr/lib/opkg/info/temper.postinst: line 4: default_postinst: not found
Collected errors:
* pkg_run_script: package "temper" postinst script returned status 127.
* opkg_configure: temper.postinst returned 127.


What's all this root stuff about?
Installing temper (1) to root...

(Last edited by projects on 6 Dec 2014, 03:01)

Congratulations! smile

What happens if you start temper?

What the??????¿

# temper
Found device: 05e3:0608
Found device: 1d6b:0002
Found device: 1130:660c
Found deviceNum 0
Trying to detach kernel driver
detach successful
detach successful
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 82, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
Other Stuff (232 bytes):
57 58 14 00 14 00 53 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 84, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
temperature 83.30F 28.50C

Yeah, it works! smile

This is just plain confusing. Ok, so it actually works then?

Restarting it shows detach errors?

# temper
Found device: 05e3:0608
Found device: 1d6b:0002
Found device: 1130:660c
Found deviceNum 0
Trying to detach kernel driver
Detach failed: No such file or directory[2]
Continuing anyway
Detach failed: No such file or directory[2]
Continuing anyway
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 82, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
Other Stuff (232 bytes):
57 58 14 00 14 00 53 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 84, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
temperature 86.00F 30.00C

Man, that's a LOT of extra bits in there hahaha. Wonder if there is some way of getting just the last line and nothing else.

Only the last line:

temper | tail -1 <--- that's the number one, not an L

(Last edited by tmo26 on 6 Dec 2014, 03:19)

Or
# usbtemp -f
83.30F