-.\" $OpenBSD: ugold.4,v 1.6 2021/04/05 16:26:06 landry Exp $
+.\" $OpenBSD: ugold.4,v 1.7 2023/04/02 17:03:14 miod Exp $
.\"
.\" Copyright (c) 2013 Takayoshi SASANO <sasano@openbsd.org>
.\" Copyright (c) 2013 Martin Pieuchot <mpi@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 5 2021 $
+.Dd $Mdocdate: April 2 2023 $
.Dt UGOLD 4
.Os
.Sh NAME
.It Li "RDing TEMPer1V1.2" Ta "1 Temperature"
.It Li "RDing TEMPerV1.4" Ta "1 Temperature"
.It Li "RDing TEMPerGold_V3.1" Ta "1 Temperature"
+.It Li "RDing TEMPerGold_V3.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"
-/* $OpenBSD: ugold.c,v 1.21 2022/01/09 05:43:00 jsg Exp $ */
+/* $OpenBSD: ugold.c,v 1.22 2023/04/02 17:03:14 miod Exp $ */
/*
* Copyright (c) 2013 Takayoshi SASANO <uaa@openbsd.org>
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPER },
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPERHUM },
{ USB_VENDOR_PCSENSORS, USB_PRODUCT_PCSENSORS_TEMPER },
+ { USB_VENDOR_WCH2, USB_PRODUCT_WCH2_TEMPER },
};
int ugold_match(struct device *, void *, void *);
break;
case USB_PRODUCT_MICRODIA_TEMPERHUM:
case USB_PRODUCT_PCSENSORS_TEMPER:
+ case USB_PRODUCT_WCH2_TEMPER:
sc->sc_hdev.sc_intr = ugold_si700x_intr;
break;
default:
break;
case USB_PRODUCT_MICRODIA_TEMPERHUM:
case USB_PRODUCT_PCSENSORS_TEMPER:
+ case USB_PRODUCT_WCH2_TEMPER:
/* 1 temperature and 1 humidity sensor */
sc->sc_sensor[UGOLD_INNER].type = SENSOR_TEMP;
strlcpy(sc->sc_sensor[UGOLD_INNER].desc, "inner",
} else if (memcmp(buf, "ld_V3.1 ", len) == 0) {
sc->sc_type = UGOLD_TYPE_GOLD;
printf("gold (temperature only)\n");
+ } else if (memcmp(buf, "ld_V3.4 ", len) == 0) {
+ sc->sc_type = UGOLD_TYPE_GOLD;
+ printf("gold (temperature only)\n");
} else {
sc->sc_type = -1;
printf("unknown\n");
}
break;
case UGOLD_CMD_DATA:
- if (buf[1] != 4 && buf[1] != 64)
+ if (buf[1] != 4 && buf[1] != 64 && buf[1] != 128)
printf("%s: invalid data length (%d bytes)\n",
sc->sc_hdev.sc_dev.dv_xname, buf[1]);
+ if (buf[1] < 4)
+ break;
temp = ugold_si700x_temp(sc->sc_type, buf[2], buf[3]);
sc->sc_sensor[UGOLD_INNER].value = (temp * 1000) + 273150000;
sc->sc_sensor[UGOLD_INNER].flags &= ~SENSOR_FINVALID;
- if (sc->sc_type != UGOLD_TYPE_GOLD) {
+ if (sc->sc_type != UGOLD_TYPE_GOLD && buf[1] >= 6) {
rhum = ugold_si700x_rhum(sc->sc_type, buf[4], buf[5], temp);
sc->sc_sensor[UGOLD_HUM].value = rhum;
sc->sc_sensor[UGOLD_HUM].flags &= ~SENSOR_FINVALID;