1 /* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef CRAS_IODEV_INFO_H_ 7 #define CRAS_IODEV_INFO_H_ 8 9 #include <stddef.h> 10 #include <stdint.h> 11 12 #define CRAS_IODEV_NAME_BUFFER_SIZE 64 13 #define CRAS_NODE_TYPE_BUFFER_SIZE 32 14 #define CRAS_NODE_MIC_POS_BUFFER_SIZE 128 15 #define CRAS_NODE_NAME_BUFFER_SIZE 64 16 #define CRAS_NODE_HOTWORD_MODEL_BUFFER_SIZE 16 17 18 /* Identifying information about an IO device. 19 * idx - iodev index. 20 * name - Name displayed to the user. 21 * stable_id - ID that does not change due to device plug/unplug or reboot. 22 */ 23 struct __attribute__((__packed__)) cras_iodev_info { 24 uint32_t idx; 25 char name[CRAS_IODEV_NAME_BUFFER_SIZE]; 26 uint32_t stable_id; 27 }; 28 29 /* Identifying information about an ionode on an iodev. 30 * iodev_idx - Index of the device this node belongs. 31 * ionode_idx - Index of this node on the device. 32 * plugged - Set true if this node is known to be plugged in. 33 * plugged_time - If plugged is true, this is the time it was attached. 34 * active - If this is the node currently being used. 35 * volume - per-node volume (0-100) 36 * capture_gain - per-node capture gain/attenuation (in 100*dBFS) 37 * left_right_swapped - Set true if left and right channels are swapped. 38 * stable_id - ID that does not change due to device plug/unplug or reboot. 39 * mic_positions - Positions of the mic array. 40 * type - Type displayed to the user. 41 * name - Name displayed to the user. 42 * active_hotword_model - name of the currently selected hotword model. 43 */ 44 struct __attribute__((__packed__)) cras_ionode_info { 45 uint32_t iodev_idx; 46 uint32_t ionode_idx; 47 int32_t plugged; 48 int32_t active; 49 struct { 50 int64_t tv_sec; 51 int64_t tv_usec; 52 } plugged_time; 53 uint32_t volume; 54 int32_t capture_gain; 55 int32_t left_right_swapped; 56 uint32_t type_enum; 57 uint32_t stable_id; 58 char mic_positions[CRAS_NODE_MIC_POS_BUFFER_SIZE]; 59 char type[CRAS_NODE_TYPE_BUFFER_SIZE]; 60 char name[CRAS_NODE_NAME_BUFFER_SIZE]; 61 char active_hotword_model[CRAS_NODE_HOTWORD_MODEL_BUFFER_SIZE]; 62 }; 63 64 /* This is used in the cras_client_set_node_attr API. 65 * IONODE_ATTR_PLUGGED - set the node as plugged/unplugged. 66 * IONODE_ATTR_VOLUME - set the node's output volume. 67 * IONODE_ATTR_CAPTURE_GAIN - set the node's capture gain. 68 * IONODE_ATTR_SWAP_LEFT_RIGHT - Swap the node's left and right channel. 69 */ 70 enum ionode_attr { 71 IONODE_ATTR_PLUGGED, 72 IONODE_ATTR_VOLUME, 73 IONODE_ATTR_CAPTURE_GAIN, 74 IONODE_ATTR_SWAP_LEFT_RIGHT 75 }; 76 77 #endif /* CRAS_IODEV_INFO_H_ */ 78