<commit_before>//
//  LogitechWirelessPresenterDriver.cpp
//  LogitechWirelessPresenter
//
//  Created by <NAME> on 10/31/12.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//

#include <IOKit/IOLib.h>
#include <IOKit/hid/IOHIDUsageTables.h>

#include "LogitechWirelessPresenterDriver.h"

#define super IOHIDEventDriver

OSDefineMetaClassAndStructors(LogitechWirelessPresenterDriver, IOHIDEventDriver)

bool LogitechWirelessPresenterDriver::start(IOService *provider)
{
    IOLog("LogitechWirelessPresenterDriver start\n");
    return super::start(provider);
}

void LogitechWirelessPresenterDriver::stop(IOService *provider)
{
    IOLog("LogitechWirelessPresenterDriver stop\n");
    return super::stop(provider);
}

void LogitechWirelessPresenterDriver::dispatchKeyboardEvent(AbsoluteTime  timeStamp,
                                                             UInt32        usagePage,
                                                             UInt32        usage,
                                                             UInt32        value,
                                                             IOOptionBits  options)
{
    /* 
     This condition seems to be always true.
     Logitech Wireless Presenter R400/R800 is basically a keyboard.
     */
    if (usagePage == kHIDPage_KeyboardOrKeypad) {
        if (usage == kHIDUsage_KeyboardPeriod) {
            usage = kHIDUsage_KeyboardB;
        } else if (usage == kHIDUsage_KeyboardF5) {
            usage = kHIDUsage_KeyboardP;
            /* Introduce a little delay between modifier and P key */
            super::dispatchKeyboardEvent(timeStamp,
                                         usagePage,
                                         kHIDUsage_KeyboardLeftGUI,
                                         value,
                                         options);
            super::dispatchKeyboardEvent(timeStamp + 1,
                                         usagePage,
                                         kHIDUsage_KeyboardLeftAlt,
                                         value,
                                         options);
            timeStamp += 2;
        }
    }

    super::dispatchKeyboardEvent(timeStamp,
                                 usagePage,
                                 usage,
                                 value,
                                 options);

}
<commit_msg>The new version or probably Japanese version uses Shift+F5. Just ignore the Shift key<commit_after>//
//  LogitechWirelessPresenterDriver.cpp
//  LogitechWirelessPresenter
//
//  Created by <NAME> on 10/31/12.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//

#include <IOKit/IOLib.h>
#include <IOKit/hid/IOHIDUsageTables.h>

#include "LogitechWirelessPresenterDriver.h"

#define super IOHIDEventDriver

OSDefineMetaClassAndStructors(LogitechWirelessPresenterDriver, IOHIDEventDriver)

bool LogitechWirelessPresenterDriver::start(IOService *provider)
{
    IOLog("LogitechWirelessPresenterDriver start\n");
    return super::start(provider);
}

void LogitechWirelessPresenterDriver::stop(IOService *provider)
{
    IOLog("LogitechWirelessPresenterDriver stop\n");
    return super::stop(provider);
}

void LogitechWirelessPresenterDriver::dispatchKeyboardEvent(AbsoluteTime  timeStamp,
                                                             UInt32        usagePage,
                                                             UInt32        usage,
                                                             UInt32        value,
                                                             IOOptionBits  options)
{
    /* 
     This condition seems to be always true.
     Logitech Wireless Presenter R400/R800 is basically a keyboard.
     */
    if (usagePage == kHIDPage_KeyboardOrKeypad) {
        if (usage == kHIDUsage_KeyboardLeftShift || usage == kHIDUsage_KeyboardLeftShift) {
            usage = 0;
        }
        if (usage == kHIDUsage_KeyboardPeriod) {
            usage = kHIDUsage_KeyboardB;
        } else if (usage == kHIDUsage_KeyboardF5) {
            usage = kHIDUsage_KeyboardP;
            /* Introduce a little delay between modifier and P key */
            super::dispatchKeyboardEvent(timeStamp,
                                         usagePage,
                                         kHIDUsage_KeyboardLeftGUI,
                                         value,
                                         options);
            super::dispatchKeyboardEvent(timeStamp + 1,
                                         usagePage,
                                         kHIDUsage_KeyboardLeftAlt,
                                         value,
                                         options);
            timeStamp += 2;
        }
    }

    super::dispatchKeyboardEvent(timeStamp,
                                 usagePage,
                                 usage,
                                 value,
                                 options);

}

{'fraction_non_alphanumeric': 0.06622516556291391, 'fraction_numerical': 0.01043548063415613, 'mean_word_length': 1.3010156971375808, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '676935', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1169, 'n_words': 234}