Logo Search packages:      
Sourcecode: kcm-tablet version File versions  Download package

bool DeviceHandler::findSerialDevice (  )  [private]

Looks for connected serial tablets (like Touchscreen laptops and so on) Updates the internal identifier for the company/device name At the moment this is done via xsetwacom get TabletID and a lot of pray Will hopefully find a better way someday

true if a device was found false if not

Definition at line 164 of file devicehandler.cpp.

References detectDeviceInformation().

Referenced by detectTablet().


    // ok up to this point we know there are some input devices connected and found via xinput
    // and the devices are not detected by lsusb

    // ok first we take the internal pad name and ask xsetwacom for a tablet ID
    // we might get lucky and detect a serial device somehow
    QString nameUsedForDetection;
    if (d->internalPadName.isEmpty()) {
        nameUsedForDetection = d->internalStylusName;
    } else {
        nameUsedForDetection = d->internalPadName;

    QString cmd = QString("xsetwacom get \"%1\" TabletID").arg(nameUsedForDetection);

    QProcess wacomToolID;

    // well it does not return anything if there is an error
    //@TODO need to check if this way to detect a tablet id works in general or just with my kubuntu setup
    QString result = QString(wacomToolID.readAll());

    // ok seems we have a tablet that can be handled with the wacom tools
    // see if we can find it in our config files to get more information
    if (!result.isEmpty()) {

        //transform tablet number into hex number (somehow .toInt(&ok,16) does not work
        int tableIntID = result.toInt();
        QString tabletHexID = QString::number(tableIntID, 16);
        for (int i = tabletHexID.count(); i < 4; i++) {

        // go through all known company's in the company list and see what we can find
        //@BUG this is definitely a problem if different company's use the same hexnumber to identify the tablet
        foreach(const QString &tempCompID, d->companyConfig->groupList()) {
            if (detectDeviceInformation(tempCompID, tabletHexID)) {
                kDebug() << "tablet ID" << tabletHexID << "found!";
                return true;

        // ok device was not found but there seems to be some kind of tablet otherwise the "result" string is empty
        // lets define the company as unknown and the device as default and hope it helps
        kError() << "found some device but no clue what the device (" << tabletHexID << ") is ... use default config for a wacom-tool tablet";
        d->companyId = QString("wacom-default");
        d->deviceId = QString("wacom-default");
        return true;
    } else {
        kError() << "xsetwacom get \"pad\" TabletID returned no information ... seems the wacom-tools are not installed or don't support your tablet";

    // to bad could still not identify the tablet
    return false;

Generated by  Doxygen 1.6.0   Back to index