• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *    stable_id_new - New stable_id, it will be deprecated and be put on
23  *        stable_id.
24  */
25 struct __attribute__ ((__packed__)) cras_iodev_info {
26 	uint32_t idx;
27 	char name[CRAS_IODEV_NAME_BUFFER_SIZE];
28 	uint32_t stable_id;
29 	uint32_t stable_id_new;
30 };
31 
32 /* Identifying information about an ionode on an iodev.
33  *    iodev_idx - Index of the device this node belongs.
34  *    ionode_idx - Index of this node on the device.
35  *    plugged - Set true if this node is known to be plugged in.
36  *    plugged_time - If plugged is true, this is the time it was attached.
37  *    active - If this is the node currently being used.
38  *    volume - per-node volume (0-100)
39  *    capture_gain - per-node capture gain/attenuation (in 100*dBFS)
40  *    left_right_swapped - Set true if left and right channels are swapped.
41  *    stable_id - ID that does not change due to device plug/unplug or reboot.
42  *    stable_id_new - New stable_id, it will be deprecated and be put on
43  *        stable_id.
44  *    mic_positions - Positions of the mic array.
45  *    type - Type displayed to the user.
46  *    name - Name displayed to the user.
47  *    active_hotword_model - name of the currently selected hotword model.
48  */
49 struct __attribute__ ((__packed__)) cras_ionode_info {
50 	uint32_t iodev_idx;
51 	uint32_t ionode_idx;
52 	int32_t plugged;
53 	int32_t active;
54 	struct { int64_t tv_sec; int64_t tv_usec; } plugged_time;
55 	uint32_t volume;
56 	int32_t capture_gain;
57 	int32_t left_right_swapped;
58 	uint32_t type_enum;
59 	uint32_t stable_id;
60 	uint32_t stable_id_new;
61 	char mic_positions[CRAS_NODE_MIC_POS_BUFFER_SIZE];
62 	char type[CRAS_NODE_TYPE_BUFFER_SIZE];
63 	char name[CRAS_NODE_NAME_BUFFER_SIZE];
64 	char active_hotword_model[CRAS_NODE_HOTWORD_MODEL_BUFFER_SIZE];
65 };
66 
67 /* This is used in the cras_client_set_node_attr API.
68  *    IONODE_ATTR_PLUGGED - set the node as plugged/unplugged.
69  *    IONODE_ATTR_VOLUME - set the node's output volume.
70  *    IONODE_ATTR_CAPTURE_GAIN - set the node's capture gain.
71  *    IONODE_ATTR_SWAP_LEFT_RIGHT - Swap the node's left and right channel.
72  */
73 enum ionode_attr {
74 	IONODE_ATTR_PLUGGED,
75 	IONODE_ATTR_VOLUME,
76 	IONODE_ATTR_CAPTURE_GAIN,
77 	IONODE_ATTR_SWAP_LEFT_RIGHT
78 };
79 
80 #endif /* CRAS_IODEV_INFO_H_ */
81