pcsensor-1.0.3 for TEMPerV1.2/TEMPerV2 with multi device and multi sensor support


昨日、TEMPerV2を使っているユーザから、「githubであなたが改造したpcsensorに対してTERMPerV2対応を加えたものを公開してる人がいる」、ということを教えてもらった。

修正版:https://github.com/waja/pcsensors/blob/master/debian/patches/multiple_temerature_readings

ソースをみてもどういう修正なのかがわからなかったので、教えてくれた人に尋ねた。
TEMPerV2は、温度センサーを2つ持っているが、pcsensor.cの1.0.2では、1つ目の温度センサーの情報しか取得できない。
2つ目の温度センサーからも温度が取得できるようにした修正であるとのこと。

というわけで、自分のところのソース修正を開始

・センサーが2個である、という決め打ち修正はよくないのでMAX_SENSORで定義し
 それ以上の個数がある場合でも容易に対応ができるように変更
・センサーが1個しかないTEMPerV1.2で、2個分取得しようとすると異常な値になるので
 waja’s pcsensor.cの修正だけでは駄目なので、修正

修正したものを「https://github.com/osakanataro/pcsensor」にて公開しました。

また、「http://blog.osakana.net/sw/pcsensor/pcsensor-1.0.3.tar.gz」にtar.gzを置いています。

・マルチデバイス時にデバイス名を出力するオプション “-d”

# ./pcsensor -d
2014/07/11 10:42:13 Bus 002 Device 003 Temperature0 88.47F 31.38C
2014/07/11 10:42:13 Bus 003 Device 003 Temperature0 74.30F 23.50C
#

・接続されているTEMPerのリスト表示 “-D”

# ./pcsensor -D
0 is Bus 002 Device 003
1 is Bus 003 Device 003
#

・接続されているTEMPerの個別表示 “-D番号”

# ./pcsensor -D0
2014/07/11 10:43:48 Temperature0 88.47F 31.38C
# ./pcsensor -D1
2014/07/11 10:44:16 Temperature0 74.30F 23.50C
#

・摂氏/華氏表示の同時指定を可能にした

# ./pcsensor -c
2014/07/11 10:44:49 Temperature0 31.38C
2014/07/11 10:44:49 Temperature0 23.50C
# ./pcsensor -f
2014/07/11 10:44:53 Temperature0 88.47F
2014/07/11 10:44:53 Temperature0 74.30F
# ./pcsensor -f -c
2014/07/11 10:45:02 Temperature0 88.47F 31.38C
2014/07/11 10:45:02 Temperature0 74.30F 23.50C
#

・1つのデバイスに2個の温度センサーがついている場合

# ./pcsensor -c -n2
2014/07/11 10:44:49 Temperature0 31.38C
2014/07/11 10:44:49 Temperature1 23.50C
#

なお、センサーが1つしかないもので、-n2指定すると以下の様な異常値になります。

# ./pcsensor -c -n2
2014/07/11 11:09:41 Temperature0 214.60F 101.45C
2014/07/11 11:09:41 Temperature1 32.00F 0.00C
#

“pcsensor-1.0.3 for TEMPerV1.2/TEMPerV2 with multi device and multi sensor support” への5件の返信

  1. Found a bug, if 2 (or more) sensors are attached to the single device. With the ‘-n#’ option the only ‘#’ sensor reading is printed. Because ‘interrupt_read_temperatura’ function overrides ‘tempC’ variable only for the first result.
    The line *tempC = temperature[i] * (125.0 / 32000.0); should be tempC[i] = ....

  2. hi, i have found a problem with TEMPer2_M12_V1.3 (my version)

    when second sensor is attached it only “sees” one device:
    nas@nas:~/pcsensor-1.0.3$ sudo ./pcsensor -D
    0 is Bus 008 Device 002

    but i have two devices:
    [ 8.138972] input: RDing TEMPer2_M12_V1.3 as /devices/pci0000:00/0000:00:1d.2/usb8/8-1/8-1:1.0/input/input2
    [ 8.139324] generic-usb 0003:0C45:7401.0001: input,hidraw0: USB HID v1.10 Keyboard [RDing TEMPer2_M12_V1.3] on usb-0000:00:1d.2-1/input0
    [ 8.153265] generic-usb 0003:0C45:7401.0002: hiddev0,hidraw1: USB HID v1.10 Device [RDing TEMPer2_M12_V1.3] on usb-0000:00:1d.2-1/input1

    any way to fix this?

  3. using this command i also only get reading of first sensor:
    nas@nas:~/pcsensor-1.0.3$ sudo ./pcsensor -c -n2
    2014/08/29 12:17:53 Temperature0 22.94C
    2014/08/29 12:17:53 Temperature1 0.00C

  4. The mrtg output for celsius is not working, you need to change lines 477 and 478 in version 1.0.3:
    currently: printf(“%.2f\n”, tempc);
    correct: printf(“%.2f\n”, tempc[j]);

Armin へ返信する コメントをキャンセル

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください