Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24a7e04a authored by Mike Lockwood's avatar Mike Lockwood
Browse files

EventHub: Compare name instead of id when excluding event input devices.

parent 4f1037ac
Loading
Loading
Loading
Loading
+12 −11
Original line number Original line Diff line number Diff line
@@ -509,28 +509,29 @@ int EventHub::open_device(const char *deviceName)
        //fprintf(stderr, "could not get device name for %s, %s\n", deviceName, strerror(errno));
        //fprintf(stderr, "could not get device name for %s, %s\n", deviceName, strerror(errno));
        name[0] = '\0';
        name[0] = '\0';
    }
    }
    if(ioctl(fd, EVIOCGPHYS(sizeof(location) - 1), &location) < 1) {
        //fprintf(stderr, "could not get location for %s, %s\n", deviceName, strerror(errno));
        location[0] = '\0';
    }
    if(ioctl(fd, EVIOCGUNIQ(sizeof(idstr) - 1), &idstr) < 1) {
        //fprintf(stderr, "could not get idstring for %s, %s\n", deviceName, strerror(errno));
        idstr[0] = '\0';
    }


    // check to see if the device is on our excluded list
    // check to see if the device is on our excluded list
    List<String8>::iterator iter = mExcludedDevices.begin();
    List<String8>::iterator iter = mExcludedDevices.begin();
    List<String8>::iterator end = mExcludedDevices.end();
    List<String8>::iterator end = mExcludedDevices.end();
    for ( ; iter != end; iter++) {
    for ( ; iter != end; iter++) {
        const char* name = *iter;
        const char* test = *iter;
        if (strcmp(name, idstr) == 0) {
        if (strcmp(name, test) == 0) {
            LOGD("ignoring event id %s driver %s\n", deviceName, name);
            LOGI("ignoring event id %s driver %s\n", deviceName, test);
            close(fd);
            close(fd);
            fd = -1;
            fd = -1;
            return -1;
            return -1;
        }
        }
    }
    }


    if(ioctl(fd, EVIOCGPHYS(sizeof(location) - 1), &location) < 1) {
        //fprintf(stderr, "could not get location for %s, %s\n", deviceName, strerror(errno));
        location[0] = '\0';
    }
    if(ioctl(fd, EVIOCGUNIQ(sizeof(idstr) - 1), &idstr) < 1) {
        //fprintf(stderr, "could not get idstring for %s, %s\n", deviceName, strerror(errno));
        idstr[0] = '\0';
    }

    int devid = 0;
    int devid = 0;
    while (devid < mNumDevicesById) {
    while (devid < mNumDevicesById) {
        if (mDevicesById[devid].device == NULL) {
        if (mDevicesById[devid].device == NULL) {