MockInputDeviceNode* getAsusGamepad() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event3");
    node->setName("ASUS Gamepad");
    // Location not set
    node->setUniqueId("C5:30:CD:50:A0:54");
    node->setBusType(0x0005);
    node->setVendorId(0x0b05);
    node->setProductId(0x4500);
    node->setVersion(0x0040);
    node->addKeys(KEY_BACK, KEY_HOMEPAGE, BTN_A, BTN_B, BTN_X, BTN_Y, BTN_TL, BTN_TR,
            BTN_MODE, BTN_THUMBL, BTN_THUMBR);
    // No relative axes
    node->addAbsAxis(ABS_X, nullptr);
    node->addAbsAxis(ABS_Y, nullptr);
    node->addAbsAxis(ABS_Z, nullptr);
    node->addAbsAxis(ABS_RZ, nullptr);
    node->addAbsAxis(ABS_GAS, nullptr);
    node->addAbsAxis(ABS_BRAKE, nullptr);
    node->addAbsAxis(ABS_HAT0X, nullptr);
    node->addAbsAxis(ABS_HAT0Y, nullptr);
    node->addAbsAxis(ABS_MISC, nullptr);
    node->addAbsAxis(0x29, nullptr);
    node->addAbsAxis(0x2a, nullptr);
    // No switches
    node->addInputProperty(INPUT_PROP_DIRECT);
    // Note: this device has MSC and LED bitmaps as well.
    return node;
}
STDMETHODIMP HostUSBDeviceFilterWrap::COMSETTER(VendorId)(IN_BSTR aVendorId)
{
    LogRelFlow(("{%p} %s: enter aVendorId=%ls\n", this, "HostUSBDeviceFilter::setVendorId", aVendorId));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = setVendorId(BSTRInConverter(aVendorId).str());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "HostUSBDeviceFilter::setVendorId", hrc));
    return hrc;
}
/* important interface functions */
void ArduinoiDigiInterfaceClass::setup(uint8_t *mac, IPAddress ip, uint32_t vendorId)
{
  setMac(mac);
  setIp(ip);
  setVendorId(vendorId);
  
  idigi_handle = idigi_init((idigi_callback_t) &ArduinoiDigiInterfaceClass::appCallback);
  AR_DEBUG_PRINTF("idigi_init complete.\r\n");  
}
MockInputDeviceNode* getMidPowerBtn() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event1");
    node->setName("mid_powerbtn");
    node->setLocation("power-button/input0");
    // UniqueId not set
    node->setBusType(0x0019);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    node->addKeys(KEY_POWER);
    // No relative axes
    // No absolute axes
    // No switches
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getGpioKeys() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event0");
    node->setName("gpio-keys");
    node->setLocation("gpio-keys/input0");
    // UniqueId not set
    node->setBusType(0x0019);
    node->setVendorId(0x0001);
    node->setProductId(0x0001);
    node->setVersion(0x0100);
    node->addKeys(KEY_CONNECT);
    // No relative axes
    // No absolute axes
    // No switches
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getH2wButton() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event4");
    node->setName("h2w button");
    // Location not set
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    node->addKeys(KEY_MEDIA);
    // No relative axes
    // No absolute axes
    // No switches
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getButtonJack() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event2");
    node->setName("apq8064-tabla-snd-card Button Jack");
    node->setLocation("ALSA");
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    node->addKeys(BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7);
    // No relative axes
    // No absolute axes
    // No switches
    // No forcefeedback
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getLidInput() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event1");
    node->setName("lid_input");
    node->setLocation("/dev/input/lid_indev");
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    // No keys
    // No relative axes
    // No absolute axes
    node->addSwitch(SW_LID);
    // No forcefeedback
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getNexusRemote() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event2");
    node->setName("Nexus Remote");
    // Location not set
    node->setUniqueId("78:86:D9:50:A0:54");
    node->setBusType(0x0005);
    node->setVendorId(0x18d1);
    node->setProductId(0x2c42);
    node->setVersion(0);
    node->addKeys(KEY_UP, KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_BACK, KEY_PLAYPAUSE,
            KEY_HOMEPAGE, KEY_SEARCH, KEY_SELECT);
    // No relative axes
    node->addAbsAxis(ABS_MISC, nullptr);
    // No switches
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
Exemple #10
0
/*!
    Initialize the gadget from settings obtained from the system.  This
    function is called if the storage gadget is \l active() when it is
    constructed.
*/
void QUsbStorageGadgetProvider::initFromSystem()
{
    QSettings settings("Trolltech", "Usb");

    QString paramPath = settings.value("PeripheralController/Path").toString() +
                        "/gadget/driver/module/parameters/";

    QFile file(paramPath + "iManufacturer");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setVendor(file.readLine().trimmed());
        file.close();
    }

    file.setFileName(paramPath + "idVendor");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setVendorId(file.readLine().trimmed().toUInt());
        file.close();
    }

    file.setFileName(paramPath + "iProduct");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setProduct(file.readLine().trimmed());
        file.close();
    }

    file.setFileName(paramPath + "idProduct");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setProductId(file.readLine().trimmed().toUInt());
        file.close();
    }

    file.setFileName(paramPath + "file");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QStringList devices = QString(file.readLine().trimmed()).split(',');
        setBackingStore(devices);
        file.close();
    }

    setValue("active", true);
}
Exemple #11
0
/*!
    Initialize the gadget from settings in the configuration file.
*/
void QUsbStorageGadgetProvider::initFromConfig()
{
    QSettings settings("Trolltech", "Usb");

    settings.beginGroup(GADGET_NAME);

    QVariant v = settings.value("Vendor");
    if (v.isValid())
        setVendor(v.toByteArray());
    else
        removeValue("vendor");

    v = settings.value("VendorId");
    if (v.isValid())
        setVendorId(v.toUInt());
    else
        removeValue("vendorId");

    v = settings.value("Product");
    if (v.isValid())
        setProduct(v.toByteArray());
    else
        removeValue("product");

    v = settings.value("ProductId");
    if (v.isValid())
        setProductId(v.toUInt());
    else
        removeValue("productId");

    v = settings.value("BackingStore");
    if (v.isValid())
        setBackingStore(v.toStringList());
    else
        removeValue("backingStore");

    settings.endGroup();

    setValue("active", false);
}
MockInputDeviceNode* getHeadsetJack() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event3");
    node->setName("apq8064-tabla-snd-card Headset Jack");
    node->setLocation("ALSA");
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    // No keys
    // No relative axes
    // No absolute axes
    node->addSwitch(SW_HEADPHONE_INSERT);
    node->addSwitch(SW_MICROPHONE_INSERT);
    node->addSwitch(SW_LINEOUT_INSERT);
    // ASUS adds some proprietary switches, but we'll only see two of them.
    node->addSwitch(0x0e);  // SW_HPHL_OVERCURRENT
    node->addSwitch(0x0f);  // SW_HPHR_OVERCURRENT
    // No forcefeedback
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
MockInputDeviceNode* getElanTouchscreen() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event0");
    node->setName("elan-touchscreen");
    // Location not set
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    // No keys
    // No relative axes
    // TODO: set the AbsoluteAxisInfo pointers
    node->addAbsAxis(ABS_MT_SLOT, nullptr);
    node->addAbsAxis(ABS_MT_TOUCH_MAJOR, nullptr);
    node->addAbsAxis(ABS_MT_POSITION_X, nullptr);
    node->addAbsAxis(ABS_MT_POSITION_Y, nullptr);
    node->addAbsAxis(ABS_MT_TRACKING_ID, nullptr);
    node->addAbsAxis(ABS_MT_PRESSURE, nullptr);
    // No switches
    // No forcefeedback
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
void DeviceClassesProxy::resetFilter()
{
    qDebug() << "DeviceClassesProxy: reset filter";
    setVendorId(QUuid());
    invalidateFilter();
}