-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit of chaos. Seems to mostly work on a raspberry pi 4. Some…
… startup scripts probably broken
- Loading branch information
Matt Bunting
authored and
Matt Bunting
committed
Apr 20, 2021
1 parent
7cc8b9e
commit 3b1fa2d
Showing
83 changed files
with
26,880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[submodule "usb-sniffify"] | ||
path = usb-sniffify | ||
url = https://github.com/blegas78/usb-sniffify.git | ||
[submodule "zmqpp"] | ||
path = zmqpp | ||
url = https://github.com/zeromq/zmqpp.git | ||
[submodule "nico"] | ||
path = nico | ||
url = https://github.com/mogillc/nico.git | ||
[submodule "raw-gadget-timeout"] | ||
path = raw-gadget-timeout | ||
url = https://github.com/xairy/raw-gadget.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project( chaos ) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") | ||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
|
||
add_subdirectory( nico/edisonLibmogiPackage/libmogi ) | ||
include_directories( nico/edisonLibmogiPackage/libmogi/include ) | ||
|
||
add_subdirectory(zmqpp) | ||
include_directories( zmqpp/src ) | ||
|
||
add_subdirectory(usb-sniffify) | ||
include_directories( usb-sniffify/include ) | ||
|
||
|
||
include_directories( include ) | ||
|
||
add_library( chaos-engine src/interface.cpp | ||
src/device.cpp | ||
src/controller.cpp | ||
src/controller-gpio.cpp | ||
src/controller-raw.cpp | ||
src/controller-state.cpp | ||
src/controller-state-dualsense.cpp | ||
src/controller-state-dualshock.cpp | ||
src/mouse.cpp | ||
src/joystick.cpp | ||
src/chaosEngine.cpp | ||
src/modifier.cpp | ||
src/sequence.cpp | ||
src/menuing.cpp | ||
include/interface.h | ||
include/device.h | ||
include/controller.h | ||
include/controller-state.h | ||
include/ps4-generated.h | ||
include/ps5-generated.h | ||
include/magicpro-generated.h | ||
include/deviceTypes.h | ||
include/chaos.h ) | ||
|
||
set(LIBS ${LIBS} chaos-engine sniffify) | ||
|
||
add_executable( chaos src/main.cpp ) | ||
add_executable( passthrough-hid src/passthroughHID.cpp ) | ||
|
||
add_executable( hid-example src/hid-example.c ) | ||
add_executable( gadget src/gadget.c ) | ||
|
||
find_package (Threads REQUIRED) | ||
|
||
#find_package (LibMogi REQUIRED) | ||
#include_directories(${LIBMOGI_INCLUDE_DIRS}) | ||
#set(LIBS ${LIBS} ${LIBMOGI_LIBRARIES}) | ||
set(LIBS ${LIBS} pthread mogi) | ||
|
||
find_package (Libusb1 REQUIRED) | ||
include_directories(${LIBUSB1_INCLUDE_DIRS}) | ||
set(LIBS ${LIBS} ${LIBUSB1_LIBRARIES}) | ||
|
||
#set(LIBS ${LIBS} pthread ) | ||
|
||
if( NOT APPLE ) | ||
#set(LIBS ${LIBS} wiringPi crypt rt ) | ||
set(LIBS ${LIBS} crypt rt ) | ||
endif() | ||
|
||
target_link_libraries( chaos ${LIBS} zmqpp zmq ) | ||
target_link_libraries( passthrough-hid ${LIBS} zmqpp zmq ) | ||
|
||
#add_executable( zmq_client src/zmq_client.cpp ) | ||
#add_executable( zmq_server src/zmq_server.cpp ) | ||
#target_link_libraries( zmq_client zmqpp zmq ) | ||
#target_link_libraries( zmq_server zmqpp zmq ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"host": "irc.twitch.tv", | ||
"port": 6667, | ||
"bot_name": "see_bot", | ||
"bot_oauth": "oauth:abcdefghijklmnopqrstuvwxyz1234", | ||
"channel_name": "#blegas78", | ||
"ui-port": 80, | ||
"chat-rate": 0.67 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# - The builtin (binary) CPack Deb generator (Unix only) | ||
# CPackDeb may be used to create Deb package using CPack. | ||
# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables | ||
# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration | ||
# | ||
# However CPackRPM has specific features which are controlled by | ||
# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on | ||
# the wiki: | ||
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 | ||
# However as a handy reminder here comes the list of specific variables: | ||
# | ||
# CPACK_DEBIAN_PACKAGE_NAME | ||
# Mandatory : YES | ||
# Default : CPACK_PACKAGE_NAME (lower case) | ||
# The debian package summary | ||
# CPACK_DEBIAN_PACKAGE_VERSION | ||
# Mandatory : YES | ||
# Default : CPACK_PACKAGE_VERSION | ||
# The debian package version | ||
# CPACK_DEBIAN_PACKAGE_ARCHITECTURE) | ||
# Mandatory : YES | ||
# Default : Output of dpkg --print-architecture or i386 | ||
# The debian package architecture | ||
# CPACK_DEBIAN_PACKAGE_DEPENDS | ||
# Mandatory : NO | ||
# Default : - | ||
# May be used to set deb dependencies. | ||
# CPACK_DEBIAN_PACKAGE_MAINTAINER | ||
# Mandatory : YES | ||
# Default : CPACK_PACKAGE_CONTACT | ||
# The debian package maintainer | ||
# CPACK_DEBIAN_PACKAGE_DESCRIPTION | ||
# Mandatory : YES | ||
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY | ||
# The debian package description | ||
# CPACK_DEBIAN_PACKAGE_SECTION | ||
# Mandatory : YES | ||
# Default : 'devel' | ||
# The debian package section | ||
# CPACK_DEBIAN_PACKAGE_PRIORITY | ||
# Mandatory : YES | ||
# Default : 'optional' | ||
# The debian package priority | ||
|
||
#============================================================================= | ||
# Copyright 2007-2009 Kitware, Inc. | ||
# Copyright 2007-2009 Mathieu Malaterre <[email protected]> | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file Copyright.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distributed this file outside of CMake, substitute the full | ||
# License text for the above reference.) | ||
|
||
# CPack script for creating Debian package | ||
# Author: Mathieu Malaterre | ||
# | ||
# http://wiki.debian.org/HowToPackageForDebian | ||
|
||
IF(CMAKE_BINARY_DIR) | ||
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.") | ||
ENDIF(CMAKE_BINARY_DIR) | ||
|
||
IF(NOT UNIX) | ||
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") | ||
ENDIF(NOT UNIX) | ||
|
||
# Let's define the control file found in debian package: | ||
|
||
# Binary package: | ||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles | ||
|
||
# DEBIAN/control | ||
# debian policy enforce lower case for package name | ||
# Package: (mandatory) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_NAME) | ||
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME) | ||
|
||
# Version: (mandatory) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_VERSION) | ||
IF(NOT CPACK_PACKAGE_VERSION) | ||
MESSAGE(FATAL_ERROR "Debian package requires a package version") | ||
ENDIF(NOT CPACK_PACKAGE_VERSION) | ||
SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION) | ||
|
||
# Architecture: (mandatory) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) | ||
# There is no such thing as i686 architecture on debian, you should use i386 instead | ||
# $ dpkg --print-architecture | ||
FIND_PROGRAM(DPKG_CMD dpkg) | ||
IF(NOT DPKG_CMD) | ||
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") | ||
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) | ||
ENDIF(NOT DPKG_CMD) | ||
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture | ||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) | ||
|
||
# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES), | ||
# this returns the successful FIND_PACKAGE() calls, maybe this can help | ||
# Depends: | ||
# You should set: DEBIAN_PACKAGE_DEPENDS | ||
# TODO: automate 'objdump -p | grep NEEDED' | ||
IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) | ||
MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) | ||
|
||
# Maintainer: (mandatory) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) | ||
IF(NOT CPACK_PACKAGE_CONTACT) | ||
MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") | ||
ENDIF(NOT CPACK_PACKAGE_CONTACT) | ||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) | ||
|
||
# Description: (mandatory) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) | ||
IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) | ||
MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") | ||
ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) | ||
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) | ||
|
||
# Section: (recommended) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_SECTION) | ||
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel") | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION) | ||
|
||
# Priority: (recommended) | ||
IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) | ||
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") | ||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) | ||
|
||
# Recommends: | ||
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS | ||
|
||
# Suggests: | ||
# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS | ||
|
||
# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA | ||
# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive) | ||
# Typical examples are: | ||
# - conffiles | ||
# - postinst | ||
# - postrm | ||
# - prerm" | ||
# Usage: | ||
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA | ||
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") | ||
|
||
|
||
# For debian source packages: | ||
# debian/control | ||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles | ||
|
||
# .dsc | ||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles | ||
|
||
# Builds-Depends: | ||
#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) | ||
# SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS | ||
# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4" | ||
# ) | ||
#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) | ||
|
||
# Description: (mandatory) | ||
#if(NOT CPACK_SECTION) | ||
# message(FATAL_ERROR "opkg package requires a package section") | ||
#endif(NOT CPACK_SECTION) | ||
|
||
# Package for opkg | ||
FIND_PROGRAM(OPKG_CMD opkg-build) | ||
if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) | ||
message("CPack: opkg-build not found. Skipping packaging") | ||
else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) | ||
SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") | ||
FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL) | ||
|
||
FILE(COPY ${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA} DESTINATION ${CPACK_OPKG_ROOTDIR}/CONTROL/ ) | ||
|
||
set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control") | ||
# Write controlfile | ||
FILE(WRITE ${CPACK_OPKG_CONTROL_FILE} | ||
"Package: ${CPACK_PACKAGE_NAME} | ||
Version: ${CPACK_PACKAGE_VERSION} | ||
Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} | ||
Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE} | ||
Section: ${CPACK_DEBIAN_PACKAGE_SECTION} | ||
Priority: optional | ||
Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER} | ||
Depends: ${CPACK_DEBIAN_PACKAGE_DEPENDS} | ||
Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES} | ||
Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES} | ||
Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS} | ||
Source: https://github.com/mogillc/nico | ||
#Essential: no | ||
") | ||
|
||
set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") | ||
execute_process( | ||
COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "." | ||
RESULT_VARIABLE _result | ||
OUTPUT_VARIABLE _res_output | ||
ERROR_VARIABLE _res_error | ||
WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY} | ||
) | ||
|
||
if(${_result}) | ||
message("Result '${_result}'") | ||
message("Output '${_res_output}'") | ||
message("Error '${_res_error}'") | ||
else(${_result}) | ||
message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.") | ||
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") | ||
file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk) | ||
endif(${_result}) | ||
endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) |
Oops, something went wrong.