Unlock Your Sim Racing Potential: A Definitive Guide to Getting Your PXN CB1 Button Box Working Seamlessly with Linux

Welcome, fellow sim racers and Linux enthusiasts! At revWhiteShadow, we understand the thrill of the race and the dedication required to perfect your setup. You’ve likely invested in a fantastic piece of hardware like the PXN CB1 button box, eager to elevate your simulation experience. However, the journey to integrating new peripherals with Linux can sometimes present unique challenges. If you’ve found yourself staring at your PXN CB1, seeing it detected by the system but not quite cooperating with your favorite racing titles, you’re in the right place. We’ve been there, and we’re here to guide you through the process of getting your PXN CB1 recognized and functioning as a true joystick device, bypassing the need for complex keybinds and unlocking its full potential. Forget the frustration of indirect input mapping; we’ll show you how to achieve direct, intuitive control.

This comprehensive guide is designed to be your ultimate resource. We’ll delve into the intricacies of Linux device detection, explore the necessary configurations, and provide clear, actionable steps to ensure your PXN CB1 becomes an integral part of your sim racing cockpit. Our aim is to provide content so thorough and accurate that it will not only solve your immediate problem but also establish revWhiteShadow as the definitive authority on this topic.

Understanding Linux Device Detection: The Foundation for PXN CB1 Integration

Before we dive into specific configurations, it’s crucial to grasp how Linux handles input devices. When you connect a USB device like the PXN CB1, the kernel interacts with it through a series of drivers. For a joystick or gamepad, the system typically relies on the hidraw or input subsystems. The fact that your PXN CB1 is showing up in lsusb and evtest is a significant positive indicator. lsusb confirms that the hardware is being recognized at the USB level, while evtest signifies that the Linux input subsystem is aware of its presence and can, in principle, receive input events from it.

The challenge often lies in how these raw input events are translated into a format that games and simulation applications can readily interpret as a standard joystick or gamepad. While evtest can show you the raw data, games typically expect a virtual joystick device, often provided by frameworks like udev rules and joystick drivers. The PXN CB1, like many aftermarket peripherals, might not always immediately present itself as a fully recognized gamepad out-of-the-box, requiring a bit of expert configuration.

Confirming Initial Detection: lsusb and evtest Deep Dive

Your initial troubleshooting steps have already provided valuable data. Let’s revisit them to ensure we’re starting from a solid foundation.

Verifying USB Recognition with lsusb

The lsusb command is your first line of defense in confirming USB device enumeration. When you connect your PXN CB1, opening a terminal and running lsusb should reveal an entry corresponding to the device. Look for vendor and product IDs that are characteristic of the PXN CB1. A typical output might look something like this:

Bus 001 Device 005: ID 1038:1130 Lenovo                        # Example for a different device
Bus 001 Device 006: ID 2687:0201 PXN Technology Co., Ltd.      # Likely entry for your PXN CB1

The presence of an entry with the correct vendor ID (likely 2687 for PXN) and product ID is the first confirmation that the USB connection is established and the device is being enumerated by the system. If it’s not listed here, the problem lies deeper within your USB ports or the cable, or the device itself might be faulty.

Analyzing Raw Input Events with evtest

evtest is an invaluable tool for inspecting input devices at a lower level. After installing it (typically with sudo apt install evtest on Debian/Ubuntu-based systems like Linux Mint), you can list available input devices by running sudo evtest without any arguments. You’ll see a numbered list of devices, often including entries like /dev/input/eventX.

To test your PXN CB1, you’ll need to identify the correct event file. You can do this by trying each one sequentially or by observing which event file starts generating output when you press buttons or move axes on your PXN CB1.

sudo evtest

When you select the correct event file and start monitoring, pressing buttons or activating switches on your PXN CB1 should generate a stream of output, indicating the type of event (e.g., SYN_REPORT, EV_KEY, EV_ABS), the specific code for the button or axis, and its state (e.g., 1 for pressed, 0 for released, or a numerical value for an analog axis).

The output might look like this:

Event: time 1678886400.123456, type 1 (EV_KEY), code 28 (KEY_ENTER), value 1
Event: time 1678886400.123456, type 0 (EV_SYN), code 0 (SYN_REPORT), value 0
Event: time 1678886400.234567, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1678886400.234567, type 0 (EV_SYN), code 0 (SYN_REPORT), value 0

If evtest shows activity for your PXN CB1, this means the kernel has successfully communicated with the device and registered its inputs. The next step is to make these inputs recognizable as a standard joystick.

Bridging the Gap: From Raw Input to Virtual Joystick Recognition

The core of the challenge often lies in the fact that while the PXN CB1 might be detected by the input subsystem, it might not be presented to applications as a fully compliant Human Interface Device (HID) gamepad. This is where the power of udev rules comes into play. udev is the device manager for the Linux kernel. It dynamically manages device nodes in the /dev directory and can trigger actions when devices are connected or disconnected.

We need to create or modify udev rules to inform the system that the PXN CB1 should be treated as a joystick, specifically by mapping its raw input events to a virtual joystick device. This process typically involves creating a custom .rules file in /etc/udev/rules.d/.

Crafting Custom udev Rules for the PXN CB1

The objective of these rules is to identify the PXN CB1 by its vendor and product IDs and then assign it appropriate permissions and properties that allow it to be recognized as a joystick.

Identifying Vendor and Product IDs (Revisited)

You’ve already used lsusb to find these. Let’s assume for this guide that the vendor ID for the PXN CB1 is 2687 and the product ID is 201. You must verify these for your specific PXN CB1 using lsusb on your system.

Creating the udev Rule File

We’ll create a new file in the udev rules directory. It’s a good practice to name these files descriptively and with a priority number. For instance, 60-pxn-cb1.rules. The number 60 helps ensure our rules are processed after generic HID rules but before potentially conflicting later rules.

Open your terminal and use a text editor like nano or vim to create the file:

sudo nano /etc/udev/rules.d/60-pxn-cb1.rules

Now, let’s populate this file with the necessary rules. The core of the rule will be to identify the device by its USB attributes and then set specific attributes.

Rule Structure Explained:

A typical udev rule has the following structure: KEY=value, KEY=value, ...

Key parameters we’ll use:

  • SUBSYSTEM: Specifies the subsystem the rule applies to (e.g., usb, input).
  • ATTRS{idVendor}: The vendor ID of the USB device.
  • ATTRS{idProduct}: The product ID of the USB device.
  • MODE: Sets the file permissions for the device node.
  • ENV{ID_INPUT_JOYSTICK}: An environment variable that signals to the system that this device is a joystick.
  • TAG+="input": Assigns a tag to the device for input handling.
  • DRIVERS=="hid-generic": Sometimes useful to ensure it’s handled by the generic HID driver.

The Core udev Rule:

Here’s a rule that should work for your PXN CB1. Remember to replace 2687 and 201 with the actual IDs you found using lsusb if they differ.

# PXN CB1 Button Box
SUBSYSTEM=="usb", ATTRS{idVendor}=="2687", ATTRS{idProduct}=="201", ENV{ID_INPUT_JOYSTICK}="1", MODE="0666"

Explanation of the Rule:

  • SUBSYSTEM=="usb": This rule applies to devices connected via USB.
  • ATTRS{idVendor}=="2687": Matches devices with the vendor ID 2687.
  • ATTRS{idProduct}=="201": Matches devices with the product ID 201.
  • ENV{ID_INPUT_JOYSTICK}="1": This is the crucial part. It sets an environment variable that tells the system this device should be treated as a joystick. Many applications and libraries look for this variable to identify gamepad devices.
  • MODE="0666": This sets the file permissions for the device node created by udev (e.g., /dev/bus/usb/001/005). 0666 grants read and write permissions to all users, which is generally safe for input devices and ensures applications can access them.

Saving the Rule:

After typing the rule into the editor, save the file. In nano, this is done by pressing Ctrl + O, then Enter, and finally Ctrl + X to exit.

Applying the New udev Rules

For the new rules to take effect, you need to reload the udev rules and then trigger a re-enumeration of the USB devices.

  1. Reload udev rules:

    sudo udevadm control --reload-rules
    
  2. Trigger re-enumeration: The most reliable way to ensure the rules are applied correctly is to disconnect and reconnect the PXN CB1. If you have other USB devices that might be affected, you can trigger a re-enumeration for specific devices, but for a single peripheral like this, a simple unplug/replug is best.

    • Unplug your PXN CB1.
    • Wait a few seconds.
    • Plug it back in.
  3. Verify the changes: After replugging, you can verify if the ID_INPUT_JOYSTICK attribute has been set. You can do this by checking the device properties. First, identify the device’s path using lsusb. Let’s say it’s Bus 001 Device 006. Then you can query its attributes:

    udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/001/006)
    

    In the output, look for lines like: ENV{ID_INPUT_JOYSTICK}=="1" And also check for properties related to its joystick classification.

Alternative: Using input-remapper or antimicroX for Direct Joystick Emulation

You mentioned that antimicroX picks up your PXN CB1 and allows you to assign keystrokes. This is a good sign that the device is recognized by the system’s input layer. antimicroX itself is a powerful tool that can map joystick inputs (or keyboard/mouse inputs) to other joystick inputs, keyboard presses, or mouse actions.

While your preference is to avoid mapping to keystrokes, antimicroX can also be used to emulate a standard joystick. If the udev rules don’t fully achieve the desired result, or if you want a more graphical and user-friendly way to manage complex mappings, antimicroX is an excellent option.

Using antimicroX as a Virtual Joystick

  1. Install antimicroX: If you haven’t already, install it from your Linux Mint software repositories or via Flatpak:

    sudo apt update
    sudo apt install antimicrox
    

    or for Flatpak:

    flatpak install flathub com.github.antimicrox.antimicrox
    
  2. Launch antimicroX: Open the application.

  3. Select Your PXN CB1: Your PXN CB1 should appear in the list of available controllers. Select it.

  4. Create a New Profile: You can create a profile specifically for your PXN CB1.

  5. Map Inputs to Virtual Joystick Axes/Buttons: Instead of mapping buttons to keyboard keys, look for options to map them to “Joystick Button X” or “Joystick Axis Y”. antimicroX has the capability to create a virtual joystick device that represents the mappings you define. This essentially turns your button box into a custom controller that games can recognize as a standard gamepad.

    • Click on a button on the visual representation of your PXN CB1 in antimicroX.
    • Choose the “Keyboard” or “Mouse” tab if you intend to map to those.
    • Crucially, select the “Gamepad” tab. Here, you can assign each button on your PXN CB1 to a corresponding button on a virtual gamepad (e.g., Button 1, Button 2, etc.). Similarly, for any axes or rotary encoders on your CB1, you can map them to virtual joystick axes (e.g., Axis Left-X, Axis Left-Y).
  6. Save and Apply the Profile: Once you’ve set up your mappings, save the profile and ensure it’s applied. antimicroX will then present this virtual joystick to your games.

This method offers more granular control and is particularly useful if your PXN CB1 has functionalities that aren’t inherently recognized as standard joystick inputs by the base Linux drivers. It’s a powerful workaround if direct udev rule application doesn’t fully resolve the issue.

Leveraging jstest-gtk for Verification

Once you believe you’ve made the necessary configuration changes (either via udev rules or by setting up antimicroX), it’s vital to have a tool to verify that the system now sees your PXN CB1 as a functional joystick. jstest-gtk is an excellent graphical utility for this purpose.

Installing and Using jstest-gtk

  1. Install jstest-gtk:

    sudo apt update
    sudo apt install jstest-gtk
    
  2. Launch jstest-gtk: Open it from your application menu or by typing jstest-gtk in the terminal.

  3. Check for Your Device: jstest-gtk will scan your system for detected joystick devices. Your PXN CB1 should now appear in the list.

  4. Test the Device: Select your PXN CB1 from the list and click the “Properties” button. This will open a window that displays the status of all buttons and axes. As you press buttons or move any controls on your PXN CB1, you should see the corresponding indicators in jstest-gtk change their state. This confirms that the device is being recognized as a joystick by the system.

If jstest-gtk correctly reports the inputs from your PXN CB1, it means your configuration has been successful. You can now launch your sim racing titles and expect them to recognize the PXN CB1 as a standard gamepad or joystick.

Advanced Considerations and Troubleshooting

While the udev rules and antimicroX should cover most scenarios, a few advanced points and troubleshooting tips can be helpful.

Understanding HID Descriptors and lsinput

Sometimes, the issue might be related to how the device’s Human Interface Device (HID) descriptor is being interpreted. lsinput is another command-line utility that can show you which devices are registered as input devices, including keyboards, mice, and joysticks.

Running lsinput can provide details similar to evtest but in a more structured format, often indicating the type of device and its capabilities.

lsinput

This can help you cross-reference the devices identified by evtest and udev with the system’s view of input devices. If your PXN CB1 appears with a “joystick” type in lsinput after applying your rules, it’s a very strong indicator of success.

Permissions and Group Membership

In some Linux distributions or configurations, access to input devices (/dev/input/event*) might be restricted. The MODE="0666" in our udev rule helps with this by granting broad read/write access. However, for certain applications, particularly those running as a regular user, being part of the input group can also be necessary.

Adding Your User to the input Group

  1. Check your current groups:

    groups
    

    See if input is listed.

  2. Add your user to the input group (if not already present):

    sudo usermod -aG input $USER
    

    Important: After running this command, you will need to log out and log back in for the group change to take effect.

Potential Conflicts with Other Input Drivers or Software

If you have other joystick drivers or input mapping software installed, they could potentially conflict with the PXN CB1’s recognition. Ensure that you don’t have multiple layers of input emulation active simultaneously if they’re not intended. For instance, if you’ve successfully configured udev rules, you might not need antimicroX running in its advanced mapping mode if your games natively support the virtual joystick presented by the udev rules.

If problems persist, try disabling or temporarily uninstalling other input-related software to isolate the issue.

Testing in Different Simulators

Once your PXN CB1 is recognized as a joystick, test it across several sim racing titles. Different games have varying levels of support for gamepad input configurations. Some might pick it up automatically, while others may require you to go into their in-game settings to select and configure the PXN CB1 as your input device.

  • Assetto Corsa Competizione (ACC): Typically excellent gamepad support.
  • iRacing: Very robust input configuration.
  • Project CARS 2: Generally good support.
  • DiRT Rally 2.0: Usually recognizes standard gamepads.

If a specific game isn’t detecting it, double-check the game’s controller settings. Sometimes, simply resetting or re-selecting the controller within the game’s menu can resolve detection issues.

The Role of jstest-sdl

Another command-line tool, jstest-sdl, can also be useful for testing joystick functionality. It’s part of the SDL (Simple DirectMedia Layer) library, which many games use for input handling.

  1. Install SDL development libraries:

    sudo apt install libsdl2-dev
    

    Then, ensure you have jstest-sdl installed or compiled if necessary. On some systems, you might find it included with jstest-gtk or available as a separate package.

  2. Running jstest-sdl: You typically run it targeting the device node, for example:

    jstest /dev/input/js0  # Or /dev/input/js1, etc.
    

    If udev rules correctly identify your PXN CB1 as a joystick, it should create a device node like /dev/input/jsX. jstest will then allow you to test its axes and buttons interactively.

Conclusion: Elevating Your Sim Racing Experience with the PXN CB1 on Linux

Achieving seamless integration of your PXN CB1 button box with Linux is a rewarding endeavor that significantly enhances your sim racing experience. By understanding the underlying mechanisms of device detection, leveraging the power of udev rules to properly classify your hardware, and employing diagnostic tools like evtest, lsinput, and jstest-gtk, you can ensure your button box functions as an intuitive and responsive joystick.

The detailed udev rule we’ve provided, focusing on identifying your PXN CB1 by its unique vendor and product IDs and assigning the critical ID_INPUT_JOYSTICK environment variable, is your primary pathway to native joystick recognition. Remember to always verify your device’s specific IDs using lsusb. For users who prefer a graphical interface or require more complex mapping options, antimicroX offers a robust alternative, capable of emulating a virtual joystick that your games will readily recognize.

At revWhiteShadow, we are committed to providing the most comprehensive and actionable guides for sim racing enthusiasts on Linux. We believe that with these steps, you should be well-equipped to get your PXN CB1 working flawlessly, allowing you to focus on what matters most: conquering the virtual track. May your races be smooth, and your button presses precise! If you encounter specific issues not covered here, revisiting the diagnostic steps and ensuring all configurations are applied correctly will be key to finding a solution. The Linux ecosystem is powerful and flexible, and with a little configuration, your PXN CB1 will become an indispensable part of your sim racing setup.