summaryrefslogtreecommitdiff
path: root/android/avctp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-05 16:13:24 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-05 16:23:42 +0200
commitcbce18be2232b2725d08caaff90333f966150301 (patch)
treee57559aefb1f25739ef0241db3c73e0d7f88b9eb /android/avctp.c
parentb47d64f7a5fda8919d11e5f320afc85f65acc706 (diff)
downloadbluez-cbce18be2232b2725d08caaff90333f966150301.tar.gz
audio/AVCTP: Lookup key name from key_map table
The key_map table already contain the key name.
Diffstat (limited to 'android/avctp.c')
-rw-r--r--android/avctp.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/android/avctp.c b/android/avctp.c
index f7544a262..1e414d1cb 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -1136,36 +1136,16 @@ int avctp_send_browsing_req(struct avctp *session,
return 0;
}
-static char *op2str(uint8_t op)
+static const char *op2str(uint8_t op)
{
- switch (op & 0x7f) {
- case AVC_VOLUME_UP:
- return "VOLUME UP";
- case AVC_VOLUME_DOWN:
- return "VOLUME DOWN";
- case AVC_MUTE:
- return "MUTE";
- case AVC_PLAY:
- return "PLAY";
- case AVC_STOP:
- return "STOP";
- case AVC_PAUSE:
- return "PAUSE";
- case AVC_RECORD:
- return "RECORD";
- case AVC_REWIND:
- return "REWIND";
- case AVC_FAST_FORWARD:
- return "FAST FORWARD";
- case AVC_EJECT:
- return "EJECT";
- case AVC_FORWARD:
- return "FORWARD";
- case AVC_BACKWARD:
- return "BACKWARD";
- default:
- return "UNKNOWN";
+ int i;
+
+ for (i = 0; key_map[i].name != NULL; i++) {
+ if ((op & 0x7F) == key_map[i].avc)
+ return key_map[i].name;
}
+
+ return "UNKNOWN";
}
static int avctp_passthrough_press(struct avctp *session, uint8_t op)