Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Load USB firmware through ioctl interface

  • Loading branch information...
commit c3efab546ef6853a82f915709fd8e61b4dd1e1ea 1 parent 8c38036
Sébastien Bourdeauducq authored February 26, 2012
2  src/Makefile
@@ -48,7 +48,7 @@ BINDIR = bin
48 48
 
49 49
 OBJS = yaffs.o version.o shellext.o sysconfig.o config.o fb.o input.o \
50 50
        keymap.o fbgrab.o shortcuts.o osc.o pngwrite.o patchpool.o \
51  
-       flashvalid.o main.o
  51
+       flashvalid.o usbfirmware.o main.o
52 52
 OBJS += $(addprefix pixbuf/,dither.o loaderjpeg.o loaderpng.o manager.o)
53 53
 OBJS += $(addprefix gui/,messagebox.o filedialog.o resmgr.o guirender.o \
54 54
 	performance.o cp.o keyboard.o ir.o audio.o midi.o oscsettings.o \
4  src/main.c
... ...
@@ -1,6 +1,6 @@
1 1
 /*
2 2
  * Flickernoise
3  
- * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
  3
+ * Copyright (C) 2010, 2011, 2012 Sebastien Bourdeauducq
4 4
  *
5 5
  * This program is free software: you can redistribute it and/or modify
6 6
  * it under the terms of the GNU General Public License as published by
@@ -51,6 +51,7 @@
51 51
 
52 52
 #include "yaffs.h"
53 53
 #include "version.h"
  54
+#include "usbfirmware.h"
54 55
 #include "renderer/videoinreconf.h"
55 56
 #include "renderer/renderer.h"
56 57
 #include "shellext.h"
@@ -188,6 +189,7 @@ rtems_task Init(rtems_task_argument argument)
188 189
 	mount("/dev/flash5", "/ssd", "yaffs", RTEMS_FILESYSTEM_READ_WRITE, "");
189 190
 	
190 191
 	init_version();
  192
+	load_usb_firmware();
191 193
 	init_videoinreconf();
192 194
 
193 195
 	sysconfig_load();
46  src/usbfirmware.c
... ...
@@ -0,0 +1,46 @@
  1
+/*
  2
+ * Flickernoise
  3
+ * Copyright (C) 2012 Sebastien Bourdeauducq
  4
+ *
  5
+ * This program is free software: you can redistribute it and/or modify
  6
+ * it under the terms of the GNU General Public License as published by
  7
+ * the Free Software Foundation, version 3 of the License.
  8
+ *
  9
+ * This program is distributed in the hope that it will be useful,
  10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12
+ * GNU General Public License for more details.
  13
+ *
  14
+ * You should have received a copy of the GNU General Public License
  15
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16
+ */
  17
+
  18
+#include <assert.h>
  19
+#include <sys/ioctl.h>
  20
+#include <sys/types.h>
  21
+#include <sys/stat.h>
  22
+#include <fcntl.h>
  23
+#include <unistd.h>
  24
+#include <rtems.h>
  25
+#include <bsp/milkymist_usbinput.h>
  26
+
  27
+#include "usbfirmware.h"
  28
+
  29
+static const unsigned char input_firmware[] = {
  30
+#include <softusb-input.h>
  31
+};
  32
+
  33
+static struct usbinput_firmware_description firmware_desc = {
  34
+	.data = input_firmware,
  35
+	.length = sizeof(input_firmware)
  36
+};
  37
+
  38
+void load_usb_firmware(void)
  39
+{
  40
+	int fd;
  41
+	
  42
+	fd = open("/dev/usbinput", O_RDONLY);
  43
+	ioctl(fd, USBINPUT_LOAD_FIRMWARE, &firmware_desc);
  44
+	assert(fd != -1);
  45
+	close(fd);
  46
+}
23  src/usbfirmware.h
... ...
@@ -0,0 +1,23 @@
  1
+/*
  2
+ * Flickernoise
  3
+ * Copyright (C) 2012 Sebastien Bourdeauducq
  4
+ *
  5
+ * This program is free software: you can redistribute it and/or modify
  6
+ * it under the terms of the GNU General Public License as published by
  7
+ * the Free Software Foundation, version 3 of the License.
  8
+ *
  9
+ * This program is distributed in the hope that it will be useful,
  10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12
+ * GNU General Public License for more details.
  13
+ *
  14
+ * You should have received a copy of the GNU General Public License
  15
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16
+ */
  17
+
  18
+#ifndef __USBFIRMWARE_H
  19
+#define __USBFIRMWARE_H
  20
+
  21
+void load_usb_firmware(void);
  22
+
  23
+#endif /* __USBFIRMWARE_H */

0 notes on commit c3efab5

Please sign in to comment.
Something went wrong with that request. Please try again.