<commit_before>#include "Joystick.h"
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <linux/joystick.h>
#include "common/logger/logger.h"

Joystick::Joystick()
{
    _joystick_fd = open("/dev/input/js0", O_RDONLY);
    if(_joystick_fd < 0)
    {
        Logger::Log(LogLevel::Warning, "Could not open joystick.");
        _isOpen = false;
    } else {
        _isOpen = true;
        Logger::Log(LogLevel::Info, "Joystick opened.");

        unsigned int numAxes=0, numButtons=0;
        ioctl(_joystick_fd, JSIOCGAXES, &numAxes);
        ioctl(_joystick_fd, JSIOCGBUTTONS, &numButtons);

        _numAxes = numAxes;
        _numButtons = numButtons;

        _state.axes.resize(numAxes);<commit_msg>Fixes bug in joystick event system<commit_after>#include "Joystick.h"
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <linux/joystick.h>
#include "common/logger/logger.h"

Joystick::Joystick()
{

    qRegisterMetaType<JoystickState>("JoystickState");
    _joystick_fd = open("/dev/input/js0", O_RDONLY);
    if(_joystick_fd < 0)
    {
        Logger::Log(LogLevel::Warning, "Could not open joystick.");
        _isOpen = false;
    } else {
        _isOpen = true;
        Logger::Log(LogLevel::Info, "Joystick opened.");

        unsigned int numAxes=0, numButtons=0;
        ioctl(_joystick_fd, JSIOCGAXES, &numAxes);
        ioctl(_joystick_fd, JSIOCGBUTTONS, &numButtons);

        _numAxes = numAxes;
        _numButtons = numButtons;

        _state.axes.resize(numAxes);
{'fraction_non_alphanumeric': 0.13964262078093978, 'fraction_numerical': 0.005294506949040371, 'mean_word_length': 3.2711864406779663, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6708616', 'n_tokens_mistral': 583, 'n_tokens_neox': 543, 'n_words': 97}