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 /*
7  * Keeps a list of playback devices that should be ignored for a card.  This is
8  * useful for devices that present non-functional alsa devices.  For instance
9  * some mics show a phantom playback device.
10  */
11 #ifndef CRAS_DEVICE_BLOCKLIST_H_
12 #define CRAS_DEVICE_BLOCKLIST_H_
13 
14 #include <stdint.h>
15 
16 #include "cras_types.h"
17 
18 struct cras_device_blocklist;
19 
20 /* Creates a blocklist of devices that should never be added to the system.
21  * Args:
22  *    config_path - Path containing the config files.
23  * Returns:
24  *    A pointer to the created blocklist on success, NULL on failure.
25  */
26 struct cras_device_blocklist *
27 cras_device_blocklist_create(const char *config_path);
28 
29 /* Destroys a blocklist returned by cras_device_blocklist_create().
30  * Args:
31  *    blocklist - Blocklist returned by cras_device_blocklist_create()
32  */
33 void cras_device_blocklist_destroy(struct cras_device_blocklist *blocklist);
34 
35 /* Checks if a playback device on a USB card is blocklisted.
36  * Args:
37  *    blocklist - Blocklist returned by cras_device_blocklist_create()
38  *    vendor_id - USB vendor ID.
39  *    product_id - USB product ID.
40  *    device_index - Index of the alsa device in the card.
41  * Returns:
42  *  1 if the device is blocklisted, 0 otherwise.
43  */
44 int cras_device_blocklist_check(struct cras_device_blocklist *blocklist,
45 				unsigned vendor_id, unsigned product_id,
46 				unsigned desc_checksum, unsigned device_index);
47 
48 #endif /* CRAS_CARD_DEVICE_BLOCKLIST_H_ */
49