Add support for ThingM blink(1) notification LED to uled(4).
This commit is contained in:
parent
f901525697
commit
0642eac437
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 5, 2014
|
||||
.Dd March 31, 2017
|
||||
.Dt ULED 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -48,7 +48,8 @@ uled_load="YES"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the Dream Cheeky WebMail Notifier device.
|
||||
driver provides support for Dream Cheeky WebMail Notifier and
|
||||
ThingM blink(1) notification LED.
|
||||
.Pp
|
||||
Subsequently, the
|
||||
.Pa /dev/uled0
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2014 Kevin Lo
|
||||
* Copyright (c) 2014, 2017 Kevin Lo
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -68,10 +68,16 @@ struct uled_softc {
|
||||
|
||||
uint8_t sc_state;
|
||||
#define ULED_ENABLED 0x01
|
||||
|
||||
int sc_flags;
|
||||
#define ULED_FLAG_BLINK1 0x0001
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
/* Initial commands. */
|
||||
static uint8_t blink1[] = { 0x1, 'v', 0, 0, 0, 0, 0, 0 };
|
||||
static uint8_t dl100b[] = { 0x1f, 0x2, 0, 0x5f, 0, 0, 0x1a, 0x3 };
|
||||
|
||||
/* Prototypes. */
|
||||
static device_probe_t uled_probe;
|
||||
static device_attach_t uled_attach;
|
||||
static device_detach_t uled_detach;
|
||||
@ -88,7 +94,7 @@ static struct usb_fifo_methods uled_fifo_methods = {
|
||||
};
|
||||
|
||||
static usb_error_t uled_ctrl_msg(struct uled_softc *, uint8_t, uint8_t,
|
||||
uint16_t, uint16_t, void *buf, uint16_t);
|
||||
uint16_t, uint16_t, void *, uint16_t);
|
||||
static int uled_enable(struct uled_softc *);
|
||||
|
||||
static devclass_t uled_devclass;
|
||||
@ -108,7 +114,10 @@ static driver_t uled_driver = {
|
||||
};
|
||||
|
||||
static const STRUCT_USB_HOST_ID uled_devs[] = {
|
||||
{USB_VPI(USB_VENDOR_DREAMLINK, USB_PRODUCT_DREAMLINK_DL100B, 0)},
|
||||
#define ULED_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
|
||||
ULED_DEV(DREAMLINK, DL100B, 0),
|
||||
ULED_DEV(THINGM, BLINK1, ULED_FLAG_BLINK1),
|
||||
#undef ULED_DEV
|
||||
};
|
||||
|
||||
DRIVER_MODULE(uled, uhub, uled_driver, uled_devclass, NULL, NULL);
|
||||
@ -141,6 +150,7 @@ uled_attach(device_t dev)
|
||||
uaa = device_get_ivars(dev);
|
||||
sc = device_get_softc(dev);
|
||||
unit = device_get_unit(dev);
|
||||
sc->sc_flags = USB_GET_DRIVER_INFO(uaa);
|
||||
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uled lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
@ -194,10 +204,11 @@ uled_ctrl_msg(struct uled_softc *sc, uint8_t rt, uint8_t reqno,
|
||||
static int
|
||||
uled_enable(struct uled_softc *sc)
|
||||
{
|
||||
static uint8_t cmdbuf[] = { 0x1f, 0x02, 0x00, 0x5f, 0x00, 0x00, 0x1a,
|
||||
0x03 };
|
||||
uint8_t *cmdbuf;
|
||||
int error;
|
||||
|
||||
cmdbuf = (sc->sc_flags & ULED_FLAG_BLINK1) ? blink1 : dl100b;
|
||||
|
||||
sc->sc_state |= ULED_ENABLED;
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
error = uled_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE, UR_SET_REPORT,
|
||||
@ -257,12 +268,21 @@ uled_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags)
|
||||
sc->sc_color.green = color.green;
|
||||
sc->sc_color.blue = color.blue;
|
||||
|
||||
buf[0] = color.red;
|
||||
buf[1] = color.green;
|
||||
buf[2] = color.blue;
|
||||
buf[3] = buf[4] = buf[5] = 0;
|
||||
buf[6] = 0x1a;
|
||||
buf[7] = 0x05;
|
||||
if (sc->sc_flags & ULED_FLAG_BLINK1) {
|
||||
buf[0] = 0x1;
|
||||
buf[1] = 'n';
|
||||
buf[2] = color.red;
|
||||
buf[3] = color.green;
|
||||
buf[4] = color.blue;
|
||||
buf[5] = buf[6] = buf[7] = 0;
|
||||
} else {
|
||||
buf[0] = color.red;
|
||||
buf[1] = color.green;
|
||||
buf[2] = color.blue;
|
||||
buf[3] = buf[4] = buf[5] = 0;
|
||||
buf[6] = 0x1a;
|
||||
buf[7] = 0x05;
|
||||
}
|
||||
error = uled_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE,
|
||||
UR_SET_REPORT, 0x200, 0, buf, sizeof(buf));
|
||||
break;
|
||||
|
@ -747,6 +747,7 @@ vendor WESTMOUNTAIN 0x2405 West Mountain Radio
|
||||
vendor TRIPPLITE 0x2478 Tripp-Lite
|
||||
vendor HIROSE 0x2631 Hirose Electric
|
||||
vendor NHJ 0x2770 NHJ
|
||||
vendor THINGM 0x27b8 ThingM
|
||||
vendor PLANEX 0x2c02 Planex Communications
|
||||
vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd
|
||||
vendor LINKINSTRUMENTS 0x3195 Link Instruments Inc.
|
||||
@ -4493,6 +4494,9 @@ product TELIT UC864G 0x1004 UC864G 3G modem
|
||||
/* Ten X Technology, Inc. */
|
||||
product TENX UAUDIO0 0xf211 USB audio headset
|
||||
|
||||
/* ThingM products */
|
||||
product THINGM BLINK1 0x01ed USB notification light
|
||||
|
||||
/* Texas Intel products */
|
||||
product TI UTUSB41 0x1446 UT-USB41 hub
|
||||
product TI TUSB2046 0x2046 TUSB2046 hub
|
||||
|
Loading…
Reference in New Issue
Block a user