• 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 /*
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_BLACKLIST_H_
12 #define CRAS_DEVICE_BLACKLIST_H_
13 
14 #include <stdint.h>
15 
16 #include "cras_types.h"
17 
18 struct cras_device_blacklist;
19 
20 /* Creates a blacklist 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 blacklist on success, NULL on failure.
25  */
26 struct cras_device_blacklist *cras_device_blacklist_create(
27 		const char *config_path);
28 
29 /* Destroys a blacklist returned by cras_device_blacklist_create().
30  * Args:
31  *    blacklist - Blacklist returned by cras_device_blacklist_create()
32  */
33 void cras_device_blacklist_destroy(struct cras_device_blacklist *blacklist);
34 
35 /* Checks if a playback device on a USB card is blacklisted.
36  * Args:
37  *    blacklist - Blacklist returned by cras_device_blacklist_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 blacklisted, 0 otherwise.
43  */
44 int cras_device_blacklist_check(struct cras_device_blacklist *blacklist,
45 				unsigned vendor_id,
46 				unsigned product_id,
47 				unsigned desc_checksum,
48 				unsigned device_index);
49 
50 #endif /* CRAS_CARD_DEVICE_BLACKLIST_H_ */
51