Hi, This diff adds support for the "TEMPer1F_H1V1.5F" USB temperature and humidity sensor to the ugold(4) driver. I got reasonable values from the device, but as mentioned in this github issue [1] they are not very accurate.
[1]: https://github.com/edorfaus/TEMPered/issues/39 stsp@ : Thanks for the opportunity to make this diff. Bye, Jan Index: sys/dev/usb/ugold.c =================================================================== RCS file: /mount/openbsd/cvs/src/sys/dev/usb/ugold.c,v retrieving revision 1.13 diff -u -p -r1.13 ugold.c --- sys/dev/usb/ugold.c 9 Jan 2017 14:44:28 -0000 1.13 +++ sys/dev/usb/ugold.c 4 Oct 2017 20:14:51 -0000 @@ -46,6 +46,7 @@ #define UGOLD_TYPE_SI7005 1 #define UGOLD_TYPE_SI7006 2 +#define UGOLD_TYPE_SHT1X 3 /* * This driver uses three known commands for the TEMPer and TEMPerHUM @@ -303,6 +304,9 @@ ugold_si700x_temp(int type, uint8_t msb, case UGOLD_TYPE_SI7006: /* 14bit and status bit */ temp = (((temp & ~3) * 21965) / 8192) - 46850; break; + case UGOLD_TYPE_SHT1X: + temp = (temp * 1000) / 256; + break; default: temp = 0; } @@ -325,6 +329,9 @@ ugold_si700x_rhum(int type, uint8_t msb, case UGOLD_TYPE_SI7006: /* 14bit and status bit */ rhum = (((rhum & ~3) * 15625) / 8192) - 6000; break; + case UGOLD_TYPE_SHT1X: /* 16 bit */ + rhum = rhum * 32; + break; default: rhum = 0; } @@ -340,7 +347,8 @@ ugold_si700x_rhum(int type, uint8_t msb, static void ugold_si700x_type(struct ugold_softc *sc, uint8_t *buf, u_int len) { - if (memcmp(buf, "TEMPerHu", len) == 0) + if (memcmp(buf, "TEMPerHu", len) == 0 || + memcmp(buf, "TEMPer1F", len) == 0) return; /* skip equal first half of the answer */ printf("%s: %d sensor%s type ", sc->sc_hdev.sc_dev.dv_xname, @@ -352,6 +360,9 @@ ugold_si700x_type(struct ugold_softc *sc } else if (memcmp(buf, "mM12V1.2", len) == 0) { sc->sc_type = UGOLD_TYPE_SI7006; printf("si7006 (temperature and humidity)\n"); + } else if (memcmp(buf, "_H1V1.5F", len) == 0) { + sc->sc_type = UGOLD_TYPE_SHT1X; + printf("sht1x (temperature and humidity)\n"); } else { sc->sc_type = -1; printf("unknown\n"); Index: share/man/man4/ugold.4 =================================================================== RCS file: /mount/openbsd/cvs/src/share/man/man4/ugold.4,v retrieving revision 1.3 diff -u -p -r1.3 ugold.4 --- share/man/man4/ugold.4 11 Aug 2015 13:41:06 -0000 1.3 +++ share/man/man4/ugold.4 4 Oct 2017 20:07:41 -0000 @@ -37,6 +37,7 @@ driver: .It Li "RDing TEMPerV1.4" Ta "1 Temperature" .It Li "RDing TEMPerHUM1V1.0" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPerHUM1V1.2" Ta "1 Temperature and 1 Humidity" +.It Li "RDing TEMPer1F_H1V1.5F Ta "1 Temperature and 1 Humidity" .El .Pp The driver possesses a collection of sensor values which are
