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

Commit 59e23c18 authored by Vidyakumar Athota's avatar Vidyakumar Athota Committed by Gerrit Code Review
Browse files

EventHub: Modify the keyboard layout file name for headset button

The keyboard layout file name was formed based on the name of
tabla sound card on current machine. If it doesn't find such
file, it is going to use Generic keyboard layout where the
key mappings are different, even though the scan code is same.
The sound card name differs across different machine types.
So, generalising the keyboard layout file name will work across
all machine types.

CRs-fixed: 344297
Change-Id: I416b6179f51ac98fe7dfae5268ffb58c243540a4
parent 12aade43
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2005 The Android Open Source Project
 * Copyright (C) 2005 The Android Open Source Project
 * Copyright (C) 2012 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@


#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <fcntl.h>
#include <memory.h>
#include <memory.h>
@@ -976,6 +978,7 @@ static const int32_t GAMEPAD_KEYCODES[] = {


status_t EventHub::openDeviceLocked(const char *devicePath) {
status_t EventHub::openDeviceLocked(const char *devicePath) {
    char buffer[80];
    char buffer[80];
    const char *temp1 = "Button Jack";


    ALOGV("Opening device: %s", devicePath);
    ALOGV("Opening device: %s", devicePath);


@@ -991,6 +994,10 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
    if(ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer) < 1) {
    if(ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer) < 1) {
        //fprintf(stderr, "could not get device name for %s, %s\n", devicePath, strerror(errno));
        //fprintf(stderr, "could not get device name for %s, %s\n", devicePath, strerror(errno));
    } else {
    } else {
        if((strstr(buffer, temp1)) != NULL) {
            memset(buffer, 0, sizeof(buffer));
            strlcpy(buffer, temp1, sizeof(buffer));
        }
        buffer[sizeof(buffer) - 1] = '\0';
        buffer[sizeof(buffer) - 1] = '\0';
        identifier.name.setTo(buffer);
        identifier.name.setTo(buffer);
    }
    }