New Devices

Introduction

This page contains information relating to the development of new devices.

Scanning

Once you have a device that is connected to your pc, you can run the following program to scan information about the device.

Initial Scan

Go to your latest installation of Keyboarding Master root directory.  Copy the code below and past into a terminal.

Scan
java -cp .:KeyboardingMaster.jar:lib/input/jinput.jar -Djava.library.path=lib/native com.monkygames.kbmaster.util.ScanHardware >& HardwareScan.log

This will write to a file called HardwareScan.log.  The file contains a list of all of your devices including possible inputs.  See the code block below.

Controller.getName == Razer Marauder Razer Marauder
Name: Razer Marauder Razer Marauder Type: Keyboard
=== Inputs === 
Number of Inputs: 163 
Name[Escape] Identifier[Escape] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]
Name[1] Identifier[1] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]
Name[2] Identifier[2] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]
Name[3] Identifier[3] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]
Name[4] Identifier[4] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]
Name[5] Identifier[5] Digital Absolute Class[net.java.games.input.Component$Identifier$Key]

Look for the new device that is being developed.  In this example, its the Razer Marauder.

Controller.getName == Razer Marauder Razer Marauder

Copy the name associated with the Controller.getName field as shown above.

Next copy the following line chaning the Razer Marauder Razer Marauder with the name of the device you are scanning for.

java -cp .:KeyboardingMaster.jar:lib/input/jinput.jar -Djava.library.path=lib/native com.monkygames.kbmaster.util.ScanHardware "Razer Marauder Razer Marauder" >& map.txt

Next, press all of the buttons on the device individually.  Once done, ctrl-c in the terminal.

At this point, you have all of the information necessary to develop a driver.  If you are assistening with the development, please pass on the HardwareScan.log and the map.txt file to the developer.  Note, if you don't want to provide the HardwareScan.log, then just note the Controller.getName as that is all that is really needed from the HardwareScan.log.  You will need to provide the map.txt though.

Programming

This section describes the required steps for adding a new device in the code.

Package

Create a new package in the com.monkygames.kbmaster.driver for the brand if it doesn't already exist.  For instance, if Razer is the manufacturer, then the com.monkygames.kbmaster.driver.razer package should already exist.  If not, create it.

Next create a package specific for the device.  For instance if the device name is Razer Orbweaver Chroma, then create the following package: com.monkygames.kbmaster.driver.razer.orbweaverchroma.

Device

The code for adding the new device should be a subclass of Device.  The new file should be in the new package directory.

todo

JavaFX File

The new device should also have a JavaFX file in the same package directory.

todo

PackageInfo

The package directory should also have a package-info.java file for javadocs.

DriverManager

Update the com.monkygames.com.kbmaster.driver.DriverManager class to add the new device.  If its a  Razer device, add it to the createRazerDriver method.  If its a new make, then create a new method for that make.  Follow the createRazerDriver method for a template.

Assets