chromium/ui/events/ozone/evdev/event_device_test_util.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/events/ozone/evdev/event_device_test_util.h"

#include <stdint.h>

#include "base/format_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/event_device_util.h"

namespace ui {

namespace {

// This test requres 64 bit groups in bitmask inputs (merge them if 32-bit).
const int kTestDataWordSize =;

#define EVDEV_BITS_TO_GROUPS(x)

std::string SerializeBitfield(unsigned long* bitmap, int max) {}

bool ParseBitfield(const std::string& bitfield,
                   size_t max_bits,
                   std::vector<unsigned long>* out) {}

}  // namespace

// Captured from HJC Game ZD - V gamepad.
const DeviceAbsoluteAxis kHJCGamepadAbsAxes[] =;
const DeviceCapabilities kHJCGamepad =;

// Captured from Xbox 360 gamepad.
const DeviceAbsoluteAxis kXboxGamepadAbsAxes[] =;
const DeviceCapabilities kXboxGamepad =;

// Captured from iBuffalo gamepad.
const DeviceAbsoluteAxis kiBuffaloGamepadAbsAxes[] =;
const DeviceCapabilities kiBuffaloGamepad =;

// Captured from Basking.
const DeviceAbsoluteAxis kBaskingTouchScreenAbsAxes[] =;

const DeviceCapabilities kBaskingTouchScreen =;

// Captured from Pixelbook.
const DeviceAbsoluteAxis kEveTouchScreenAbsAxes[] =;
const DeviceCapabilities kEveTouchScreen =;

// Captured from Pixel Slate.
const DeviceAbsoluteAxis kNocturneTouchScreenAbsAxes[] =;
const DeviceCapabilities kNocturneTouchScreen =;

// Captured from Chromebook Pixel.
const DeviceCapabilities kLinkKeyboard =;

// Captured from Chromebook Pixel.
const DeviceAbsoluteAxis kLinkTouchscreenAbsAxes[] =;
const DeviceCapabilities kLinkTouchscreen =;

// Fake Atmel touchscreen based on real device from Chromebook Pixel,
// with the addition of ABS_MT_TOOL_TYPE capability.
const DeviceAbsoluteAxis kLinkWithToolTypeTouchscreenAbsAxes[] =;
const DeviceCapabilities kLinkWithToolTypeTouchscreen =;

// Captured from Chromebook Pixel.
const DeviceAbsoluteAxis kLinkTouchpadAbsAxes[] =;
const DeviceCapabilities kLinkTouchpad =;

const DeviceCapabilities kMorphiusPointingStick =;

const DeviceCapabilities kMorphiusTabletModeSwitch =;

// Captured from generic HP KU-1156 USB keyboard.
const DeviceCapabilities kHpUsbKeyboard =;

// Captured from generic HP KU-1156 USB keyboard (2nd device with media keys).
const DeviceAbsoluteAxis kHpUsbKeyboard_ExtraAbsAxes[] =;
const DeviceCapabilities kHpUsbKeyboard_Extra =;

// Captured from Dell MS111-L 3-Button Optical USB Mouse.
const DeviceCapabilities kLogitechUsbMouse =;

// Captured from "Mimo Touch 2" Universal DisplayLink monitor.
const DeviceAbsoluteAxis kMimoTouch2TouchscreenAbsAxes[] =;
const DeviceCapabilities kMimoTouch2Touchscreen =;

// Captured from Wacom Intuos Pen and Touch Small Tablet.
const DeviceAbsoluteAxis kWacomIntuosPtS_PenAbsAxes[] =;
const DeviceCapabilities kWacomIntuosPtS_Pen =;

// Captured from Wacom Intuos Pen and Touch Small Tablet.
const DeviceAbsoluteAxis kWacomIntuosPtS_FingerAbsAxes[] =;
const DeviceCapabilities kWacomIntuosPtS_Finger =;

// Captured from Logitech Wireless Touch Keyboard K400.
const DeviceAbsoluteAxis kLogitechTouchKeyboardK400AbsAxes[] =;
const DeviceCapabilities kLogitechTouchKeyboardK400 =;

// Captured from Elo TouchSystems 2700 touchscreen.
const DeviceAbsoluteAxis kElo_TouchSystems_2700AbsAxes[] =;
const DeviceCapabilities kElo_TouchSystems_2700 =;

// Captured from Intel reference design: "Wilson Beach".
const DeviceAbsoluteAxis kWilsonBeachActiveStylusAbsAxes[] =;
const DeviceCapabilities kWilsonBeachActiveStylus =;

// Captured from Eve Chromebook
const DeviceAbsoluteAxis kEveStylusAbsAxes[] =;
const DeviceCapabilities kEveStylus =;

// Captured from Pixel Slate
const DeviceAbsoluteAxis kNocturneStylusAbsAxes[] =;
const DeviceCapabilities kNocturneStylus =;

const DeviceCapabilities kHammerKeyboard =;

const DeviceAbsoluteAxis kHammerTouchpadAbsAxes[] =;
const DeviceCapabilities kHammerTouchpad =;

// Captured from Logitech Tap touch controller
const DeviceAbsoluteAxis kIlitekTP_Mouse_AbsAxes[] =;
const DeviceCapabilities kIlitekTP_Mouse =;
const DeviceAbsoluteAxis kIlitekTPAbsAxes[] =;
const DeviceCapabilities kIlitekTP =;

const DeviceCapabilities kSideVolumeButton =;

const DeviceAbsoluteAxis kKohakuTouchscreenAxes[] =;
// Captured from Kohaku EVT
const DeviceCapabilities kKohakuTouchscreen =;

const DeviceAbsoluteAxis kKohakuStylusAxes[] =;

// Captured from Kohaku EVT
const DeviceCapabilities kKohakuStylus =;

const DeviceAbsoluteAxis kXboxEliteAxes[] =;

// captured from Xbox Elite series 2 controller
const DeviceCapabilities kXboxElite =;
const DeviceCapabilities kDellActivePenButton =;

const DeviceAbsoluteAxis kDrallionStylusAxes[] =;

const DeviceCapabilities kDrallionStylus =;

const DeviceCapabilities kDrallionKeyboard =;

const DeviceCapabilities kPuffMicrophoneMuteSwitch =;

const DeviceCapabilities kDrawciaStylusGarage =;

// The built-in keyboard for Eve, which has an Assistant key.
const DeviceCapabilities kEveKeyboard =;

// The built-in keyboard on Sarien, which has a few more keys than normal.
const DeviceCapabilities kSarienKeyboard =;

// The built-in keyboard on Woomax, which has a numeric pad
const DeviceCapabilities kWoomaxKeyboard =;

// The keyboard of a Drobit
const DeviceCapabilities kDrobitKeyboard =;

// The numberpad-aspect of the touchpad on Drobit.
const DeviceCapabilities kDrobitNumberpad =;

const DeviceCapabilities kLogitechKeyboardK120 =;
const DeviceAbsoluteAxis kMicrosoftBluetoothNumberPadAbsAxes[] =;
const DeviceCapabilities kMicrosoftBluetoothNumberPad =;

// Captured from Dell Latitude E6510, which report non valid resolutions and is
// semi-multitouch.
const ui::DeviceAbsoluteAxis kDellLatitudeE6510TouchpadAbsAxes[] =;
const ui::DeviceCapabilities kDellLatitudeE6510Touchpad =;

// Captured from HP ProBook 6560b. Touchpad that is semi-multitouch.
const ui::DeviceAbsoluteAxis kHPProBook6560bTouchpadAbsAxes[] =;
const ui::DeviceCapabilities kHPProBook6560bTouchpad =;

const DeviceCapabilities kJinlonKeyboard =;

// Captured from Redrix. Haptic touchpad.
const DeviceAbsoluteAxis kRedrixTouchpadAxes[] =;
const DeviceCapabilities kRedrixTouchpad =;

const DeviceCapabilities kSymbolTechBarcodeScanner =;

const DeviceAbsoluteAxis kRexHeatmapTouchScreenAbsAxes[] =;

const DeviceCapabilities kRexHeatmapTouchScreen =;

const DeviceCapabilities kSplitModifierKeyboard =;

// NB: Please use the capture_device_capabilities.py script to add more
// test data here. This will help ensure the data matches what the kernel
// reports for a real device and is entered correctly.
//
// For Chrome OS, you can run the script by installing a test image and running:
//   DEVICE_IP=<your device IP>
//   cd ui/events/ozone/evdev/
//   scp capture_device_capabilities.py "root@${DEVICE_IP}:/tmp/"
//   ssh "root@${DEVICE_IP}" python /tmp/capture_device_capabilities.py

bool CapabilitiesToDeviceInfo(const DeviceCapabilities& capabilities,
                              EventDeviceInfo* devinfo) {}

}  // namespace ui