diff options
author | phk <phk@FreeBSD.org> | 2004-04-27 13:09:21 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-04-27 13:09:21 +0000 |
commit | 4cbcf74a28b0988c6542c1e34a71414c56e34b2b (patch) | |
tree | f07656ba4b52ff8df68ffa6e490bc2d3719dfb5f /sys/dev/led/led.c | |
parent | 2a3a9b994df6f37306196264c383770c28ddd101 (diff) | |
download | FreeBSD-src-4cbcf74a28b0988c6542c1e34a71414c56e34b2b.zip FreeBSD-src-4cbcf74a28b0988c6542c1e34a71414c56e34b2b.tar.gz |
Add the ability to avoid repetition of s.... sequences with a '.'
Diffstat (limited to 'sys/dev/led/led.c')
-rw-r--r-- | sys/dev/led/led.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 7177547..5e93e3b 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -52,10 +52,14 @@ led_timeout(void *p) sc->count--; continue; } - if (*sc->ptr >= 'a' && *sc->ptr <= 'j') + if (*sc->ptr == '.') { + sc->ptr = NULL; + continue; + } else if (*sc->ptr >= 'a' && *sc->ptr <= 'j') { sc->func(sc->private, 0); - else if (*sc->ptr >= 'A' && *sc->ptr <= 'J') + } else if (*sc->ptr >= 'A' && *sc->ptr <= 'J') { sc->func(sc->private, 1); + } sc->count = *sc->ptr & 0xf; sc->ptr++; if (*sc->ptr == '\0') @@ -153,11 +157,10 @@ led_write(dev_t dev, struct uio *uio, int ioflag) */ case 's': for(s++; *s; s++) { - if ((*s & 0x0f) > 10) - continue; - if ((*s & 0xf0) < ' ') - continue; - sbuf_bcat(sb, s, 1); + if ((*s >= 'a' && *s <= 'j') || + (*s >= 'A' && *s <= 'J') || + *s == '.') + sbuf_bcat(sb, s, 1); } break; /* @@ -249,6 +252,7 @@ led_create(led_t *func, void *priv, char const *name) sbuf_delete(sb); mtx_lock(&led_mtx); LIST_INSERT_HEAD(&led_list, sc, list); + sc->func(sc->private, 0); mtx_unlock(&led_mtx); return (sc->dev); } |