Mercurial > audlegacy-plugins
view src/rocklight/sysled.c @ 3162:e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
This driver uses the "safe" ALSA API subset, including use of blocking I/O.
Right now, it is hardcoded to use "default".
Do not complain about bugs in this plugin.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 14 May 2009 21:05:11 -0500 |
parents | ed2d7787779e |
children |
line wrap: on
line source
/* * Copyright (C) 2006 Tony Vroon <chainsaw@gentoo.org> * Copyright (C) 2007 Michael Hanselmann <audacious@hansmi.ch> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <unistd.h> #include <stdlib.h> #include "rocklight.h" int sysled_set(int fd, int state) { if (state) { return write(fd, "255\n", 4); } else { return write(fd, "0\n", 2); } } int sysled_get(int fd) { char buf[256]; int ret = read(fd, &buf, sizeof(buf)); if(!ret) return 0; //dummy return (strtol(buf, NULL, 10) == 255); }