Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Load USB firmware through ioctl interface

  • Loading branch information...
commit c3efab546ef6853a82f915709fd8e61b4dd1e1ea 1 parent 8c38036
Sébastien Bourdeauducq sbourdeauducq authored
2  src/Makefile
View
@@ -48,7 +48,7 @@ BINDIR = bin
OBJS = yaffs.o version.o shellext.o sysconfig.o config.o fb.o input.o \
keymap.o fbgrab.o shortcuts.o osc.o pngwrite.o patchpool.o \
- flashvalid.o main.o
+ flashvalid.o usbfirmware.o main.o
OBJS += $(addprefix pixbuf/,dither.o loaderjpeg.o loaderpng.o manager.o)
OBJS += $(addprefix gui/,messagebox.o filedialog.o resmgr.o guirender.o \
performance.o cp.o keyboard.o ir.o audio.o midi.o oscsettings.o \
4 src/main.c
View
@@ -1,6 +1,6 @@
/*
* Flickernoise
- * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
+ * Copyright (C) 2010, 2011, 2012 Sebastien Bourdeauducq
*
* 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
@@ -51,6 +51,7 @@
#include "yaffs.h"
#include "version.h"
+#include "usbfirmware.h"
#include "renderer/videoinreconf.h"
#include "renderer/renderer.h"
#include "shellext.h"
@@ -188,6 +189,7 @@ rtems_task Init(rtems_task_argument argument)
mount("/dev/flash5", "/ssd", "yaffs", RTEMS_FILESYSTEM_READ_WRITE, "");
init_version();
+ load_usb_firmware();
init_videoinreconf();
sysconfig_load();
46 src/usbfirmware.c
View
@@ -0,0 +1,46 @@
+/*
+ * Flickernoise
+ * Copyright (C) 2012 Sebastien Bourdeauducq
+ *
+ * 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, version 3 of the License.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <assert.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <rtems.h>
+#include <bsp/milkymist_usbinput.h>
+
+#include "usbfirmware.h"
+
+static const unsigned char input_firmware[] = {
+#include <softusb-input.h>
+};
+
+static struct usbinput_firmware_description firmware_desc = {
+ .data = input_firmware,
+ .length = sizeof(input_firmware)
+};
+
+void load_usb_firmware(void)
+{
+ int fd;
+
+ fd = open("/dev/usbinput", O_RDONLY);
+ ioctl(fd, USBINPUT_LOAD_FIRMWARE, &firmware_desc);
+ assert(fd != -1);
+ close(fd);
+}
23 src/usbfirmware.h
View
@@ -0,0 +1,23 @@
+/*
+ * Flickernoise
+ * Copyright (C) 2012 Sebastien Bourdeauducq
+ *
+ * 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, version 3 of the License.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __USBFIRMWARE_H
+#define __USBFIRMWARE_H
+
+void load_usb_firmware(void);
+
+#endif /* __USBFIRMWARE_H */
Please sign in to comment.
Something went wrong with that request. Please try again.