Skip to content

Commit

Permalink
Load USB firmware through ioctl interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Feb 26, 2012
1 parent 8c38036 commit c3efab5
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -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 \
Expand Down
4 changes: 3 additions & 1 deletion src/main.c
@@ -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
Expand Down Expand Up @@ -51,6 +51,7 @@

#include "yaffs.h"
#include "version.h"
#include "usbfirmware.h"
#include "renderer/videoinreconf.h"
#include "renderer/renderer.h"
#include "shellext.h"
Expand Down Expand Up @@ -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();
Expand Down
46 changes: 46 additions & 0 deletions src/usbfirmware.c
@@ -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 changes: 23 additions & 0 deletions src/usbfirmware.h
@@ -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 */

0 comments on commit c3efab5

Please sign in to comment.