Hello,

The message of uthum(4)'s calibration offset is incorrect
when the offset is -1 < degC < 0.

I wrote the patch and it is oked by yuo@ (via twitter[1]),
but two months has passed. So I send the patch to tech@ to check again.

ok?

[1] https://twitter.com/uaa/status/362275395430658049

----
SASANO Takayoshi <u...@mx5.nisiq.net>

Index: uthum.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uthum.c,v
retrieving revision 1.23
diff -u -p -r1.23 uthum.c
--- uthum.c     8 May 2013 08:26:25 -0000       1.23
+++ uthum.c     26 Sep 2013 20:28:12 -0000
@@ -820,15 +820,19 @@ uthum_print_sensorinfo(struct uthum_soft
                printf("type %s (temperature)",
                    uthum_sensor_type_s[s->dev_type]);
                if (s->cal_offset)
-                       printf(", calibration offset %d.%d degC",
-                           s->cal_offset / 100, abs(s->cal_offset % 100));
+                       printf(", calibration offset %c%d.%d degC",
+                           (s->cal_offset < 0) ? '-' : '+',
+                           abs(s->cal_offset / 100),
+                           abs(s->cal_offset % 100));
                break;
        case SENSOR_HUMIDITY:
                printf("type %s (humidity)",
                    uthum_sensor_type_s[s->dev_type]);
                if (s->cal_offset)
-                       printf("calibration offset %d.%d %%RH",
-                           s->cal_offset / 100, abs(s->cal_offset % 100));
+                       printf("calibration offset %c%d.%d %%RH",
+                           (s->cal_offset < 0) ? '-' : '+',
+                           abs(s->cal_offset / 100),
+                           abs(s->cal_offset % 100));
                break;
        default:
                printf("unknown");


Reply via email to