From 4178ca2e52f8e5a440128b375ce47bf234ccb462 Mon Sep 17 00:00:00 2001 From: Raphael Assenat Date: Sun, 6 Dec 2015 23:10:27 -0500 Subject: [PATCH] tool to tools --- README.md | 64 ++++++++++++++++++++++++++ tool/99-raphnet.rules | 1 - tool/Makefile.mingw | 26 ----------- tool/README | 4 -- {tool => tools}/Makefile | 5 +- {tool => tools}/delay.c | 0 {tool => tools}/delay.h | 0 {tool => tools}/gc2n64_adapter.c | 0 {tool => tools}/gc2n64_adapter.h | 0 {tool => tools}/gcn64.c | 0 {tool => tools}/gcn64.h | 0 {tool => tools}/gcn64_priv.h | 0 {tool => tools}/gcn64cfg.glade | 0 {tool => tools}/gcn64ctl_gui.c | 2 +- {tool => tools}/gcn64ctl_gui.h | 0 {tool => tools}/gcn64ctl_gui_mpkedit.c | 0 {tool => tools}/gcn64ctl_gui_mpkedit.h | 0 {tool => tools}/gcn64lib.c | 0 {tool => tools}/gcn64lib.h | 0 {tool => tools}/gcn64utils.h | 0 {tool => tools}/hexdump.c | 0 {tool => tools}/hexdump.h | 0 {tool => tools}/hid.c | 0 {tool => tools}/hidapi.h | 0 {tool => tools}/ihex.c | 0 {tool => tools}/ihex.h | 0 {tool => tools}/main.c | 0 {tool => tools}/memmem.c | 0 {tool => tools}/mempak.c | 0 {tool => tools}/mempak.h | 0 {tool => tools}/mempak_convert.c | 0 {tool => tools}/mempak_extract_note.c | 0 {tool => tools}/mempak_format.c | 0 {tool => tools}/mempak_fs.c | 0 {tool => tools}/mempak_fs.h | 0 {tool => tools}/mempak_gcn64usb.c | 0 {tool => tools}/mempak_gcn64usb.h | 0 {tool => tools}/mempak_insert_note.c | 0 {tool => tools}/mempak_ls.c | 0 {tool => tools}/mempak_rm.c | 0 {tool => tools}/sleep.c | 0 {tool => tools}/sleep.h | 0 {tool => tools}/strcasestr.c | 0 {tool => tools}/strcasestr.h | 0 {tool => tools}/version.h | 0 45 files changed, 69 insertions(+), 33 deletions(-) create mode 100644 README.md delete mode 100644 tool/99-raphnet.rules delete mode 100644 tool/Makefile.mingw delete mode 100644 tool/README rename {tool => tools}/Makefile (95%) rename {tool => tools}/delay.c (100%) rename {tool => tools}/delay.h (100%) rename {tool => tools}/gc2n64_adapter.c (100%) rename {tool => tools}/gc2n64_adapter.h (100%) rename {tool => tools}/gcn64.c (100%) rename {tool => tools}/gcn64.h (100%) rename {tool => tools}/gcn64_priv.h (100%) rename {tool => tools}/gcn64cfg.glade (100%) rename {tool => tools}/gcn64ctl_gui.c (99%) rename {tool => tools}/gcn64ctl_gui.h (100%) rename {tool => tools}/gcn64ctl_gui_mpkedit.c (100%) rename {tool => tools}/gcn64ctl_gui_mpkedit.h (100%) rename {tool => tools}/gcn64lib.c (100%) rename {tool => tools}/gcn64lib.h (100%) rename {tool => tools}/gcn64utils.h (100%) rename {tool => tools}/hexdump.c (100%) rename {tool => tools}/hexdump.h (100%) rename {tool => tools}/hid.c (100%) rename {tool => tools}/hidapi.h (100%) rename {tool => tools}/ihex.c (100%) rename {tool => tools}/ihex.h (100%) rename {tool => tools}/main.c (100%) rename {tool => tools}/memmem.c (100%) rename {tool => tools}/mempak.c (100%) rename {tool => tools}/mempak.h (100%) rename {tool => tools}/mempak_convert.c (100%) rename {tool => tools}/mempak_extract_note.c (100%) rename {tool => tools}/mempak_format.c (100%) rename {tool => tools}/mempak_fs.c (100%) rename {tool => tools}/mempak_fs.h (100%) rename {tool => tools}/mempak_gcn64usb.c (100%) rename {tool => tools}/mempak_gcn64usb.h (100%) rename {tool => tools}/mempak_insert_note.c (100%) rename {tool => tools}/mempak_ls.c (100%) rename {tool => tools}/mempak_rm.c (100%) rename {tool => tools}/sleep.c (100%) rename {tool => tools}/sleep.h (100%) rename {tool => tools}/strcasestr.c (100%) rename {tool => tools}/strcasestr.h (100%) rename {tool => tools}/version.h (100%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..c3ce0a3 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# Gamecube/N64 to USB adapter + +## Introduction + +This is the source code for a Gamecube/N64 controller to USB adapter firmware +meant to run on [raphnet.net Multiuse PCB-X](http://www.raphnet.net/electronique/multiuse_pcbX/index_en.php). + +The project homepage is located at: http://www.raphnet.net/electronique/multiuse_pcbX/index.php + +## License + +The project is released under the General Public License version 3. + +## Directories + + * / : The firmware source code + * tool/ : This directory contains utilities to configure and update an adapter, manipulate mempak + image files, etc. + * scripts/ : Scripts and/or useful files + +## Compiling the firmware + +You will need a working avr-gcc toolchain with avr-libc and standard utilities such as make. Just +type 'make' and it should build just fine. Under Linux at least. + +## Programming the firmware + +The makefile has a convenient 'flash' target which sends a command to the firmware to enter +the bootloader and then executes dfu-programmer (it must of course be installed) with the +correct arguments. + +Note that the tool must be compiled first and your permissions must also be set so that your +user may access the device. See 'Using the tools' below for more information. + +## Compiling the tools + +In the tool/ directory, just type make. + +There are a few dependencies: + - libhidapi-dev + - libhidapi-hidraw0 + - pkg-config + - gtk3 (for the gui only) + +Provided you have all the dependencies installed, under Linux at least, it should +compile without errors. For other environments such has MinGW, there are provisions +in the makefile to auto-detect and tweak the build accordingly, but it if fails, be +prepared to hack the makefile. + +## Using the tools + +Under Linux, you should configure udev to give the proper permissions to your user, +otherwise communicating with the device won't be possible. The same requirement +also applies to dfu-programmer. + +An easy way to do this is to copy the two files below to /etc/udev/rules.d, restart +udev and reconnect the devices. + +scripts/99-atmel-dfu.rules +scripts/99-raphnet.rules + +For information on how to actually /use/ the tools, try --help. Ex: + +$ ./gcn64ctl --help diff --git a/tool/99-raphnet.rules b/tool/99-raphnet.rules deleted file mode 100644 index bafa4e3..0000000 --- a/tool/99-raphnet.rules +++ /dev/null @@ -1 +0,0 @@ -SUBSYSTEM=="hidraw", ATTRS{idVendor}=="289b", ATTRS{idProduct}=="0017", MODE="0664", GROUP="plugdev" diff --git a/tool/Makefile.mingw b/tool/Makefile.mingw deleted file mode 100644 index 1aedd31..0000000 --- a/tool/Makefile.mingw +++ /dev/null @@ -1,26 +0,0 @@ -CC=gcc -LD=$(CC) - -CFLAGS=-Wall -g -LDFLAGS=-lsetupapi - -PREFIX=/usr/local - -PROG=gcn64ctl - -OBJS=main.o gcn64.o mempak.o gcn64lib.o hexdump.o gc2n64_adapter.o ihex.o delay.o hid.o sleep.o memmem.o - -.PHONY : clean install - -all: $(OBJS) - $(LD) $(OBJS) $(LDFLAGS) -o $(PROG) - -%.o: %.c %.h - $(CC) $(CFLAGS) -c $< - -clean: - rm -f *.o $(PROG) - -install: - @echo "Install not done yet. Sorry" - diff --git a/tool/README b/tool/README deleted file mode 100644 index 1b0cf06..0000000 --- a/tool/README +++ /dev/null @@ -1,4 +0,0 @@ - - -libhidapi-dev -pkg-config diff --git a/tool/Makefile b/tools/Makefile similarity index 95% rename from tool/Makefile rename to tools/Makefile index 853ea01..1fde6e7 100644 --- a/tool/Makefile +++ b/tools/Makefile @@ -26,7 +26,7 @@ MEMPAKLIB_OBJS=mempak.o mempak_fs.o $(COMPAT_OBJS) .PHONY : clean install -all: $(PROGS) +all: $(PROGS) gui.xml gcn64ctl_gui: gcn64ctl_gui.o gcn64ctl_gui_mpkedit.o gcn64.o gcn64lib.o hexdump.o ihex.o mempak_gcn64usb.o $(MEMPAKLIB_OBJS) $(LD) $^ $(LDFLAGS) $(GTK_LDFLAGS) -o $@ @@ -37,6 +37,9 @@ gcn64ctl: main.o gcn64.o gcn64lib.o hexdump.o gc2n64_adapter.o ihex.o delay.o me gcn64ctl_gui.o: gcn64ctl_gui.c gcn64ctl_gui.h $(CC) $(CFLAGS) $(GTK_CFLAGS) -c $< +gui.xml: gcn64cfg.glade + grep -v requires gcn64cfg.glade > gui.xml + gcn64ctl_gui_mpkedit.o: gcn64ctl_gui_mpkedit.c gcn64ctl_gui_mpkedit.h $(CC) $(CFLAGS) $(GTK_CFLAGS) -c $< diff --git a/tool/delay.c b/tools/delay.c similarity index 100% rename from tool/delay.c rename to tools/delay.c diff --git a/tool/delay.h b/tools/delay.h similarity index 100% rename from tool/delay.h rename to tools/delay.h diff --git a/tool/gc2n64_adapter.c b/tools/gc2n64_adapter.c similarity index 100% rename from tool/gc2n64_adapter.c rename to tools/gc2n64_adapter.c diff --git a/tool/gc2n64_adapter.h b/tools/gc2n64_adapter.h similarity index 100% rename from tool/gc2n64_adapter.h rename to tools/gc2n64_adapter.h diff --git a/tool/gcn64.c b/tools/gcn64.c similarity index 100% rename from tool/gcn64.c rename to tools/gcn64.c diff --git a/tool/gcn64.h b/tools/gcn64.h similarity index 100% rename from tool/gcn64.h rename to tools/gcn64.h diff --git a/tool/gcn64_priv.h b/tools/gcn64_priv.h similarity index 100% rename from tool/gcn64_priv.h rename to tools/gcn64_priv.h diff --git a/tool/gcn64cfg.glade b/tools/gcn64cfg.glade similarity index 100% rename from tool/gcn64cfg.glade rename to tools/gcn64cfg.glade diff --git a/tool/gcn64ctl_gui.c b/tools/gcn64ctl_gui.c similarity index 99% rename from tool/gcn64ctl_gui.c rename to tools/gcn64ctl_gui.c index 0ac6125..46fe424 100644 --- a/tool/gcn64ctl_gui.c +++ b/tools/gcn64ctl_gui.c @@ -815,7 +815,7 @@ main( int argc, app.builder = gtk_builder_new(); /* Load UI from file. If error occurs, report it and quit application. * Replace "tut.glade" with your saved project. */ - if( ! gtk_builder_add_from_file( app.builder, "gcn64cfg.glade", &error ) ) + if( ! gtk_builder_add_from_file( app.builder, "gui.xml", &error ) ) { g_warning( "%s", error->message ); g_free( error ); diff --git a/tool/gcn64ctl_gui.h b/tools/gcn64ctl_gui.h similarity index 100% rename from tool/gcn64ctl_gui.h rename to tools/gcn64ctl_gui.h diff --git a/tool/gcn64ctl_gui_mpkedit.c b/tools/gcn64ctl_gui_mpkedit.c similarity index 100% rename from tool/gcn64ctl_gui_mpkedit.c rename to tools/gcn64ctl_gui_mpkedit.c diff --git a/tool/gcn64ctl_gui_mpkedit.h b/tools/gcn64ctl_gui_mpkedit.h similarity index 100% rename from tool/gcn64ctl_gui_mpkedit.h rename to tools/gcn64ctl_gui_mpkedit.h diff --git a/tool/gcn64lib.c b/tools/gcn64lib.c similarity index 100% rename from tool/gcn64lib.c rename to tools/gcn64lib.c diff --git a/tool/gcn64lib.h b/tools/gcn64lib.h similarity index 100% rename from tool/gcn64lib.h rename to tools/gcn64lib.h diff --git a/tool/gcn64utils.h b/tools/gcn64utils.h similarity index 100% rename from tool/gcn64utils.h rename to tools/gcn64utils.h diff --git a/tool/hexdump.c b/tools/hexdump.c similarity index 100% rename from tool/hexdump.c rename to tools/hexdump.c diff --git a/tool/hexdump.h b/tools/hexdump.h similarity index 100% rename from tool/hexdump.h rename to tools/hexdump.h diff --git a/tool/hid.c b/tools/hid.c similarity index 100% rename from tool/hid.c rename to tools/hid.c diff --git a/tool/hidapi.h b/tools/hidapi.h similarity index 100% rename from tool/hidapi.h rename to tools/hidapi.h diff --git a/tool/ihex.c b/tools/ihex.c similarity index 100% rename from tool/ihex.c rename to tools/ihex.c diff --git a/tool/ihex.h b/tools/ihex.h similarity index 100% rename from tool/ihex.h rename to tools/ihex.h diff --git a/tool/main.c b/tools/main.c similarity index 100% rename from tool/main.c rename to tools/main.c diff --git a/tool/memmem.c b/tools/memmem.c similarity index 100% rename from tool/memmem.c rename to tools/memmem.c diff --git a/tool/mempak.c b/tools/mempak.c similarity index 100% rename from tool/mempak.c rename to tools/mempak.c diff --git a/tool/mempak.h b/tools/mempak.h similarity index 100% rename from tool/mempak.h rename to tools/mempak.h diff --git a/tool/mempak_convert.c b/tools/mempak_convert.c similarity index 100% rename from tool/mempak_convert.c rename to tools/mempak_convert.c diff --git a/tool/mempak_extract_note.c b/tools/mempak_extract_note.c similarity index 100% rename from tool/mempak_extract_note.c rename to tools/mempak_extract_note.c diff --git a/tool/mempak_format.c b/tools/mempak_format.c similarity index 100% rename from tool/mempak_format.c rename to tools/mempak_format.c diff --git a/tool/mempak_fs.c b/tools/mempak_fs.c similarity index 100% rename from tool/mempak_fs.c rename to tools/mempak_fs.c diff --git a/tool/mempak_fs.h b/tools/mempak_fs.h similarity index 100% rename from tool/mempak_fs.h rename to tools/mempak_fs.h diff --git a/tool/mempak_gcn64usb.c b/tools/mempak_gcn64usb.c similarity index 100% rename from tool/mempak_gcn64usb.c rename to tools/mempak_gcn64usb.c diff --git a/tool/mempak_gcn64usb.h b/tools/mempak_gcn64usb.h similarity index 100% rename from tool/mempak_gcn64usb.h rename to tools/mempak_gcn64usb.h diff --git a/tool/mempak_insert_note.c b/tools/mempak_insert_note.c similarity index 100% rename from tool/mempak_insert_note.c rename to tools/mempak_insert_note.c diff --git a/tool/mempak_ls.c b/tools/mempak_ls.c similarity index 100% rename from tool/mempak_ls.c rename to tools/mempak_ls.c diff --git a/tool/mempak_rm.c b/tools/mempak_rm.c similarity index 100% rename from tool/mempak_rm.c rename to tools/mempak_rm.c diff --git a/tool/sleep.c b/tools/sleep.c similarity index 100% rename from tool/sleep.c rename to tools/sleep.c diff --git a/tool/sleep.h b/tools/sleep.h similarity index 100% rename from tool/sleep.h rename to tools/sleep.h diff --git a/tool/strcasestr.c b/tools/strcasestr.c similarity index 100% rename from tool/strcasestr.c rename to tools/strcasestr.c diff --git a/tool/strcasestr.h b/tools/strcasestr.h similarity index 100% rename from tool/strcasestr.h rename to tools/strcasestr.h diff --git a/tool/version.h b/tools/version.h similarity index 100% rename from tool/version.h rename to tools/version.h