Restructure code layout

Copy files to individual folders. This makes it cleaner to add new
functionality in the future.
pull/7/head
nirenjan 2015-12-08 21:46:42 -08:00
parent 326075406a
commit c87e785a18
27 changed files with 154 additions and 90 deletions

21
.gitignore vendored
View File

@ -14,3 +14,24 @@ Module.symvers
# Vim swap files # Vim swap files
.*.swp .*.swp
# Autotools objects
.deps
.dirstamp
.libs
ar-lib
autom4te.cache
m4
compile
config.*
configure
depcomp
install-sh
libtool
ltmain.sh
missing
Makefile
Makefile.in
*.la
*.lo
*.m4

47
Makefile.am 100644
View File

@ -0,0 +1,47 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libx52 test cli util
# lib_LTLIBRARIES = libx52.la libx52util.la
#
# # Core libx52 library
# # This library handles the USB communication between the host and the X52
# libx52_la_SOURCES = src/x52_common.h src/x52_commands.h \
# src/x52_control.c src/x52_core.c \
# src/x52_date_time.c src/x52_mfd_led.c
# libx52_la_LDFLAGS = -version-info 2:0:1 -lusb-1.0
#
# # libx52 utility library
# # This library provides extra utilities for ease of use
# libx52util_la_SOURCES = src/util_char_map.c
# libx52util_la_CFLAGS = -I $(srcdir)/src
# libx52util_la_LDFLAGS = -version-info 1:0:0
# libx52util_la_LIBADD = libx52.la
#
# # Header files that need to be copied
# pkginclude_HEADERS = src/libx52.h
#
# # Binaries that use the above libraries
# bin_PROGRAMS = x52cli x52test
#
# # Command line utility that front ends the core library
# x52cli_SOURCES = src/x52_cli.c
# x52cli_LDADD = libx52.la
#
# # Test utility that exercises all the library functions
# x52test_SOURCES = src/x52_test.c src/x52_test_mfd.c src/x52_test_led.c \
# src/x52_test_clock.c src/x52_test_common.h
# x52test_LDADD = libx52.la
#
# # Extra files that need to be in the distribution
# EXTRA_DIST = src/x52_char_map.cfg \
# src/x52_char_map.h \
# src/libx52.h
#
# # Character map generator
# noinst_PROGRAMS = x52charmapgen
# x52charmapgen_SOURCES = src/char_map_parser_gen.c
#
# # Autogenerated file that needs to be cleaned up
# CLEANFILES = src/util_char_map.c
# src/util_char_map.c: $(srcdir)/src/x52_char_map.cfg x52charmapgen$(EXEEXT)
# $(AM_V_GEN) ./x52charmapgen$(EXEEXT) $(srcdir)/src/x52_char_map.cfg $@

View File

@ -8,16 +8,27 @@ display which is programmable.
Currently, only Windows drivers are available from Saitek PLC, which Currently, only Windows drivers are available from Saitek PLC, which
led me to develop a new Linux driver which can program the MFD and led me to develop a new Linux driver which can program the MFD and
the individual LEDs on the joystick. Although the standard usbhid the individual LEDs on the joystick. The standard usbhid driver is
driver is capable of reading the joystick, it is not sufficient to capable of reading the joystick, but it cannot control the MFD or LEDs.
really utilize all the capabilities of this system.
This project is currently a work-in-progress. However a high level Most of the extra functionality can be handled from userspace. See
outline of the current objectives are listed below: the individual folders for README information.
# Building
Build has been tested on Ubuntu 14.04 LTS on x86_64.
## Prerequisites
You will need the following packages:
* automake
* autoconf
* libusb-1.0-0-dev (Package name may vary across distributions)
## Installation
1. Clone the repository
2. Run autogen.sh
3. Run configure; make and sudo make install.
* Write a kernel module and export sysfs interfaces to act as a
driver.
* Write a userspace program that can configure the kernel module
and create custom button mappings to keyboard or mouse events.
* Add interrupt handling and export a /dev/input/jsX interface.
* Allow userspace programs to register callbacks on MFD button events.

8
cli/Makefile.am 100644
View File

@ -0,0 +1,8 @@
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = x52cli
# Command line utility that front ends the core library
x52cli_SOURCES = x52_cli.c
x52cli_CFLAGS = @X52_INCLUDE@
x52cli_LDADD = @X52_CORE_LIB@

View File

@ -1,4 +1,4 @@
AC_INIT([libx52], [1.1.0], [nirenjan@gmail.com]) AC_INIT([x52pro-linux], [0.1.0], [nirenjan@gmail.com])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_PROG_CC AC_PROG_CC
@ -16,11 +16,21 @@ if test "x${have_libusb}" != xyes; then
AC_MSG_ERROR([ AC_MSG_ERROR([
------------------------------------------------------- -------------------------------------------------------
The library libusb-1.0 and header file libusb.h The library libusb-1.0 and header file libusb.h
are required to build libx52. Stopping... are required to build x52pro-linux. Stopping...
Check 'config.log' for more information. Check 'config.log' for more information.
------------------------------------------------------- -------------------------------------------------------
]) ])
fi fi
AC_CONFIG_FILES([Makefile]) AC_SUBST([X52_PKG_VERSION], [0.1])
AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/libx52"])
AC_SUBST([X52_CORE_LIB], [../libx52/libx52.la])
AC_CONFIG_FILES([
Makefile
libx52/Makefile
test/Makefile
cli/Makefile
util/Makefile
])
AC_OUTPUT AC_OUTPUT

21
libx52/.gitignore vendored
View File

@ -1,21 +0,0 @@
# Ignore autogenerated files
.deps
.dirstamp
.libs
ar-lib
autom4te.cache
m4
compile
config.*
configure
depcomp
install-sh
libtool
ltmain.sh
missing
Makefile
Makefile.in
*.la
*.lo
*.m4
libx52-*.*

View File

@ -1,46 +1,16 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libx52.la libx52util.la lib_LTLIBRARIES = libx52.la
# Core libx52 library # Core libx52 library
# This library handles the USB communication between the host and the X52 # This library handles the USB communication between the host and the X52
libx52_la_SOURCES = src/x52_common.h src/x52_commands.h \ libx52_la_SOURCES = x52_control.c x52_core.c x52_date_time.c x52_mfd_led.c
src/x52_control.c src/x52_core.c \
src/x52_date_time.c src/x52_mfd_led.c
libx52_la_LDFLAGS = -version-info 2:0:1 -lusb-1.0 libx52_la_LDFLAGS = -version-info 2:0:1 -lusb-1.0
# libx52 utility library
# This library provides extra utilities for ease of use
libx52util_la_SOURCES = src/util_char_map.c
libx52util_la_CFLAGS = -I $(srcdir)/src
libx52util_la_LDFLAGS = -version-info 1:0:0
libx52util_la_LIBADD = libx52.la
# Header files that need to be copied # Header files that need to be copied
pkginclude_HEADERS = src/libx52.h x52includedir = $(includedir)/x52pro-@X52_PKG_VERSION@
x52include_HEADERS = libx52.h
# Binaries that use the above libraries # pkginclude_HEADERS = libx52.h
bin_PROGRAMS = x52cli x52test
# Command line utility that front ends the core library
x52cli_SOURCES = src/x52_cli.c
x52cli_LDADD = libx52.la
# Test utility that exercises all the library functions
x52test_SOURCES = src/x52_test.c src/x52_test_mfd.c src/x52_test_led.c \
src/x52_test_clock.c src/x52_test_common.h
x52test_LDADD = libx52.la
# Extra files that need to be in the distribution # Extra files that need to be in the distribution
EXTRA_DIST = src/x52_char_map.cfg \ EXTRA_DIST = libx52.h x52_commands.h x52_common.h
src/x52_char_map.h \
src/libx52.h
# Character map generator
noinst_PROGRAMS = x52charmapgen
x52charmapgen_SOURCES = src/char_map_parser_gen.c
# Autogenerated file that needs to be cleaned up
CLEANFILES = src/util_char_map.c
src/util_char_map.c: $(srcdir)/src/x52_char_map.cfg x52charmapgen$(EXEEXT)
$(AM_V_GEN) ./x52charmapgen$(EXEEXT) $(srcdir)/src/x52_char_map.cfg $@

View File

@ -17,22 +17,3 @@ Note that when writing text to the MFD, the line length is limited to 16
characters. While you can pass a longer string, the library will only consider characters. While you can pass a longer string, the library will only consider
the first 16 characters for writing to the display. the first 16 characters for writing to the display.
# Building the library
Build has been tested on Ubuntu 14.04 LTS on x86_64.
## Prerequisites
You will need the following packages:
* automake
* autoconf
* libusb-1.0-0-dev (Package name may vary across distributions)
## Installation
1. Clone the parent Git repository
2. Run autogen.sh
3. Run configure; make and sudo make install.
The test program is not installed. Use x52cli to communicate with the joystick
and set the LEDs and MFD state.

11
test/Makefile.am 100644
View File

@ -0,0 +1,11 @@
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = x52test
# Test utility that exercises all the library functions
x52test_SOURCES = x52_test.c x52_test_mfd.c x52_test_led.c x52_test_clock.c
x52test_CFLAGS = @X52_INCLUDE@
x52test_LDADD = @X52_CORE_LIB@
# Extra files that need to be in the distribution
EXTRA_DIST = x52_test_common.h

26
util/Makefile.am 100644
View File

@ -0,0 +1,26 @@
ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libx52util.la
# libx52 utility library
# This library provides extra utilities for ease of use
libx52util_la_SOURCES = util_char_map.c
libx52util_la_CFLAGS = -I $(top_srcdir)/libx52
libx52util_la_LDFLAGS = -version-info 1:0:0
libx52util_la_LIBADD = ../libx52/libx52.la
# Header files that need to be copied
# pkginclude_HEADERS =
# Extra files that need to be in the distribution
EXTRA_DIST = x52_char_map.cfg \
x52_char_map.h
# Character map generator
noinst_PROGRAMS = x52charmapgen
x52charmapgen_SOURCES = char_map_parser_gen.c
# Autogenerated file that needs to be cleaned up
CLEANFILES = util_char_map.c
util_char_map.c: $(srcdir)/x52_char_map.cfg x52charmapgen$(EXEEXT)
$(AM_V_GEN) ./x52charmapgen$(EXEEXT) $(srcdir)/x52_char_map.cfg $@