Page 5 of 6

Re: Arduino only-based adapter (no PC needed)

Posted: Wed May 29, 2019 7:32 am
by ThijsNL
Yes, i've noticed that and it is possible.
However for me it would not work because when you drive a hot lap in F1 2018, you cannot permit 0.5s connection loss.
I could implement it for others.

Best option would be to let say 'clone' the authentication of a controller that you own so that you only have to 'read' it once and that you don't have to connect it. With some effort this might be possible. However once again this appealing to piracy and way beyond the ToS ;) Lets keep it this (gimx) way.

Re: Arduino only-based adapter (no PC needed)

Posted: Wed May 29, 2019 5:19 pm
by dar2q
maybe we can use some of the clone controllers chips like nuvoton

https://www.cybersecobservatory.com/201 ... mware-usb/

Re: Arduino only-based adapter (no PC needed)

Posted: Thu May 30, 2019 11:52 pm
by Mysli0210
Thijs, what if the connection was just re-initialized and not dropped at any point?
i have no idea if that would be possible, but just an idea :)

Also cloning controllers could maybe work. also, would it be piracy? i mean its not like you're selling controllers, but mere making yours talk to the ps4.

IMO there should not be anything that could legally prevent you from hacking or tapping into a system that you bought, as long as you don't use it for otherwise illegal purposes ie. running copyrighted content on the console.

Re: Arduino only-based adapter (no PC needed)

Posted: Fri Jun 28, 2019 10:06 pm
by Mysli0210
when trying to compile (both an edited and an unedited version)
i get these errors

Code: Select all

Arduino: 1.8.9 (Windows 10), Board: "Arduino Leonardo"

In file included from C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/Arduino.h:233:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/version_helper.h:24,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:117,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\PS4AuthDevice.h:29,

                 from sketch\PS4AuthDevice.cpp:26:

C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/USBAPI.h:152:16: error: conflicting declaration 'Serial_ Serial'

 extern Serial_ Serial;

                ^

In file included from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\PS4AuthDevice.h:29,

                 from sketch\PS4AuthDevice.cpp:26:

H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:61:19: note: previous declaration as 'LUFASerial Serial'

 extern LUFASerial Serial;

                   ^

In file included from C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/Arduino.h:233:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/version_helper.h:24,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:117,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\DrivingForceGT.h:28,

                 from sketch\DrivingForceGT.cpp:26:

C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/USBAPI.h:152:16: error: conflicting declaration 'Serial_ Serial'

 extern Serial_ Serial;

                ^

In file included from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\DrivingForceGT.h:28,

                 from sketch\DrivingForceGT.cpp:26:

H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:61:19: note: previous declaration as 'LUFASerial Serial'

 extern LUFASerial Serial;

                   ^

In file included from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\DrivingForceGT.h:28,

                 from sketch\G29WheelEmu.cpp:27:

H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:61:19: error: conflicting declaration 'LUFASerial Serial'

 extern LUFASerial Serial;

                   ^

In file included from C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/Arduino.h:233:0,

                 from sketch\LUFAConfig.h:45,

                 from sketch\Descriptors.h:48,

                 from sketch\G29WheelEmu.h:41,

                 from sketch\G29WheelEmu.cpp:26:

C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/USBAPI.h:152:16: note: previous declaration as 'Serial_ Serial'

 extern Serial_ Serial;

                ^

In file included from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/Usb.h:27:0,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/usbhid.h:20,

                 from H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/hiduniversal.h:21,

                 from sketch\DrivingForceGT.h:28,

                 from H:\Users\Kasper\Dokumenter\Arduino\g29emu\g29emu\g29emu.ino:36:

H:\Users\Kasper\Dokumenter\Arduino\libraries\USB_Host_Shield_Library_2_0-1.3.2/settings.h:61:19: error: conflicting declaration 'LUFASerial Serial'

 extern LUFASerial Serial;

                   ^

In file included from C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/Arduino.h:233:0,

                 from sketch\g29emu.ino.cpp:1:

C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/USBAPI.h:152:16: note: previous declaration as 'Serial_ Serial'

 extern Serial_ Serial;

                ^

G29WheelEmu.cpp:37:19: error: conflicting declaration 'LUFASerial Serial'

 extern LUFASerial Serial;

                   ^

In file included from C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/Arduino.h:233:0,

                 from sketch\LUFAConfig.h:45,

                 from sketch\Descriptors.h:48,

                 from sketch\G29WheelEmu.h:41,

                 from sketch\G29WheelEmu.cpp:26:

C:\Users\Kasper\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.22\cores\arduino/USBAPI.h:152:16: note: previous declaration as 'Serial_ Serial'

 extern Serial_ Serial;

                ^

sketch\G29WheelEmu.cpp: In function 'void ReceiveNextReport()':

G29WheelEmu.cpp:173:18: error: 'class Serial_' has no member named 'printhex'

           Serial.printhex(buffer[1]);

                  ^

G29WheelEmu.cpp:178:20: error: 'class Serial_' has no member named 'printhex'

             Serial.printhex(buffer[x]);

                    ^

exit status 1
conflicting declaration 'LUFASerial Serial'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Re: Arduino only-based adapter (no PC needed)

Posted: Sat Jul 13, 2019 1:24 am
by Mysli0210
I fixed the error :D
I had to do the following:
  • Download arduino 1.8.5 (as seen in ThijsNL's screenshot)
  • Place it in a seperate folder from the normal arduino ide folder
  • Inside this folder create a folder called "portable" this will force the IDE to not use the Arduino15 folder which holds cores, all your regular configs and such.
    and thereby make LUFA actually work, as it works by blocking a lot of files that has to do with USB handling
  • Install git https://git-scm.com/download/win
  • Install python 3.3 (newest version probably works too, but 3.3 has been tested) https://www.python.org/downloads/release/python-330/
  • Inside the arduino folder Shift+right click on libraries and click on "open Powershell window here"
  • Inside the Powershell run the following commands

    Code: Select all

    git clone --recursive https://github.com/Palatis/Arduino-Lufa.git LUFA

    Code: Select all

    ./LUFA/activate.py
  • Extract gimx lite https://github.com/mathijsvandenberg/g29emu into <ARDUINO FOLDER>\portable\sketchbook\g29emu (no sub folders)
  • Extract newest version of USB Host Shield Library https://www.arduinolibraries.info/libra ... ibrary-2-0 into <ARDUINO FOLDER>\libraries
  • Edit <ARDUINO FOLDER>\libraries\USB_Host_Shield_Library_2_0-1.3.2\settings.h so that it looks like this

    Code: Select all

    /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    
    This software may be distributed and modified under the terms of the GNU
    General Public License version 2 (GPL2) as published by the Free Software
    Foundation and appearing in the file GPL2.TXT included in the packaging of
    this file. Please note that GPL2 Section 2[b] requires that all works based
    on this software must also be made publicly available under the terms of
    the GPL2 ("Copyleft").
    
    Contact information
    -------------------
    
    Circuits At Home, LTD
    Web      :  http://www.circuitsathome.com
    e-mail   :  support@circuitsathome.com
     */
    
    #ifndef USB_HOST_SHIELD_SETTINGS_H
    #define USB_HOST_SHIELD_SETTINGS_H
    #include "macros.h"
    
    ////////////////////////////////////////////////////////////////////////////////
    // SPI Configuration
    ////////////////////////////////////////////////////////////////////////////////
    #ifndef USB_SPI
    #define USB_SPI SPI
    //#define USB_SPI SPI1
    #endif
    
    ////////////////////////////////////////////////////////////////////////////////
    // DEBUGGING
    ////////////////////////////////////////////////////////////////////////////////
    
    /* Set this to 1 to activate serial debugging */
    #define ENABLE_UHS_DEBUGGING 0
    
    /* This can be used to select which serial port to use for debugging if
     * multiple serial ports are available.
     * For example Serial3.
    *#ifndef USB_HOST_SERIAL
    *#define USB_HOST_SERIAL Serial
    *#endif
    */
    
    #ifndef USB_HOST_SERIAL
    class LUFASerial {
    	private:
    	public:
    	 LUFASerial();
       void begin(long baud);
    	 void print(const char* StringPtr);
       void print(long value);
       void write(int value);
       void printhex(int value);
       void println(long value,int type);
    	 void println(const char* StringPtr);
       void println(long value);
    };
    
    extern LUFASerial Serial;
    
    
    #define USB_HOST_SERIAL Serial
    #endif
    
    ////////////////////////////////////////////////////////////////////////////////
    // Manual board activation
    ////////////////////////////////////////////////////////////////////////////////
    
    /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
    #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
    
    /* Set this to 1 if you are using a Black Widdow */
    #define USE_UHS_BLACK_WIDDOW 0
    
    /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
    #define USE_XMEM_SPI_LOCK 0
    
    ////////////////////////////////////////////////////////////////////////////////
    // Wii IR camera
    ////////////////////////////////////////////////////////////////////////////////
    
    /* Set this to 1 to activate code for the Wii IR camera */
    #define ENABLE_WII_IR_CAMERA 0
    
    ////////////////////////////////////////////////////////////////////////////////
    // MASS STORAGE
    ////////////////////////////////////////////////////////////////////////////////
    // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
    // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
    // Each LUN needs ~13 bytes to be able to track the state of each unit.
    #ifndef MASS_MAX_SUPPORTED_LUN
    #define MASS_MAX_SUPPORTED_LUN 8
    #endif
    
    ////////////////////////////////////////////////////////////////////////////////
    // Set to 1 to use the faster spi4teensy3 driver.
    ////////////////////////////////////////////////////////////////////////////////
    #ifndef USE_SPI4TEENSY3
    #define USE_SPI4TEENSY3 1
    #endif
    
    // Disabled on the Teensy LC, as it is incompatible for now
    #if defined(__MKL26Z64__)
    #undef USE_SPI4TEENSY3
    #define USE_SPI4TEENSY3 0
    #endif
    
    ////////////////////////////////////////////////////////////////////////////////
    // AUTOMATIC Settings
    ////////////////////////////////////////////////////////////////////////////////
    
    // No user serviceable parts below this line.
    // DO NOT change anything below here unless you are a developer!
    
    #include "version_helper.h"
    
    #if defined(__GNUC__) && defined(__AVR__)
    #ifndef GCC_VERSION
    #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
    #endif
    #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
    #ifdef PROGMEM
    #undef PROGMEM
    #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
    #ifdef PSTR
    #undef PSTR
    #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
    #endif
    #endif
    #endif
    #endif
    
    #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
    #define DEBUG_USB_HOST
    #endif
    
    #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
    #define WIICAMERA
    #endif
    
    // To use some other locking (e.g. freertos),
    // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
    // NOTE: NO argument is passed. You have to do this within your routine for
    // whatever you are using to lock and unlock.
    #if !defined(XMEM_ACQUIRE_SPI)
    #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
    #include <xmem.h>
    #else
    #define XMEM_ACQUIRE_SPI() (void(0))
    #define XMEM_RELEASE_SPI() (void(0))
    #endif
    #endif
    
    #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
    #include <xmem.h>
    #else
    #define EXT_RAM 0
    #endif
    
    #if defined(CORE_TEENSY) && defined(KINETISK)
    #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
    #else
    #define USING_SPI4TEENSY3 0
    #endif
    
    #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
    #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
    #endif
    #ifdef RBL_NRF51822
    #include <nrf_gpio.h>
    #include <SPI_Master.h>
    #define SPI SPI_Master
    #define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t
    #endif
    #if defined(__PIC32MX__) || defined(__PIC32MZ__)
    #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
    #endif
    
    #if defined(ESP8266) || defined(ESP32)
    #define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t
    #endif
    
    #ifdef STM32F4
    #include "stm32f4xx_hal.h"
    extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
    #endif
    
    // Fix defines on Arduino Due
    #ifdef ARDUINO_SAM_DUE
    #ifdef tokSETUP
    #undef tokSETUP
    #endif
    #ifdef tokIN
    #undef tokIN
    #endif
    #ifdef tokOUT
    #undef tokOUT
    #endif
    #ifdef tokINHS
    #undef tokINHS
    #endif
    #ifdef tokOUTHS
    #undef tokOUTHS
    #endif
    #endif
    
    // Set defaults
    #ifndef MFK_CASTUINT8T
    #define MFK_CASTUINT8T
    #endif
    
    // Workaround issue: https://github.com/esp8266/Arduino/issues/2078
    #ifdef ESP8266
    #undef PROGMEM
    #define PROGMEM
    #undef PSTR
    #define PSTR(s) (s)
    #undef pgm_read_byte
    #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
    #undef pgm_read_word
    #define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
    #endif
    
    #ifdef ARDUINO_ESP8266_WIFIO
    #error "This board is currently not supported"
    #endif
    
    #endif /* SETTINGS_H */
    
And that should be it if i remember correctly, and also this could probably be done in a more clean way.

Re: Arduino only-based adapter (no PC needed)

Posted: Sun Jul 14, 2019 1:38 pm
by Matlo
Please stop calling this project 'GIMX lite'. People are getting confused, and mistakenly think this is developed by the GIMX team. Thanks for your understanding.

Re: Arduino only-based adapter (no PC needed)

Posted: Mon Mar 09, 2020 12:10 am
by eried
I wonder how could I adapt this for Xbox one? can someone give me tips how to adapt it? (I already asked in github but I am wondering if someone has done this here)
Mysli0210 wrote:
Sat Jul 13, 2019 1:24 am
I fixed the error :D
Awesome! thanks for the instructions! I struggled for an hour before finding your instructions.

Re: Arduino only-based adapter (no PC needed)

Posted: Sat Mar 28, 2020 7:23 pm
by kornyakoff
Good afternoon! Guys, is there a connection diagram and links to the USB HUB. thank you in advance

Re: Arduino only-based adapter (no PC needed)

Posted: Sat Apr 04, 2020 12:24 pm
by fraca7
Hello; I'm very interested to know if you encountered the same problem as me during this; see https://gimx.fr/forum/viewtopic.php?f=20&t=3351

Re: Arduino only-based adapter (no PC needed)

Posted: Tue Jun 16, 2020 11:46 am
by monyol
Hi

First of all many thanks for this contribution. Very useful the take the best of my old wheel...

I am newbie in Arduino and do not want disturb anyone with this question... but, I wonder if it would be possible to compile and load this code for an Arduino R3 (ATMEGA328P) and which changes I would have to put in place.

I put all pieces together following the guide but I used a R3 (I already had one :roll: )instead a Leonardo one to try, and I got a message telling USB_DEVICE_ONLY not available for my board model.

If there is any way I will try... If not I will buy a Leonardo one.

thx