-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ALSA: oxfw: Add proc interface for debugging purpose
This commit adds proc interface to get information about stream formation. This commit also adds snd_oxfw_stream_get_current_formation() to get current stream formation. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
- Loading branch information
Takashi Sakamoto
authored and
Takashi Iwai
committed
Dec 10, 2014
1 parent
5cd1d3f
commit 3c96101
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
snd-oxfw-objs := oxfw-command.o oxfw-stream.o oxfw-control.o oxfw-pcm.o oxfw.o | ||
snd-oxfw-objs := oxfw-command.o oxfw-stream.o oxfw-control.o oxfw-pcm.o \ | ||
oxfw-proc.o oxfw.o | ||
obj-m += snd-oxfw.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* oxfw_proc.c - a part of driver for OXFW970/971 based devices | ||
* | ||
* Copyright (c) 2014 Takashi Sakamoto | ||
* | ||
* Licensed under the terms of the GNU General Public License, version 2. | ||
*/ | ||
|
||
#include "./oxfw.h" | ||
|
||
static void proc_read_formation(struct snd_info_entry *entry, | ||
struct snd_info_buffer *buffer) | ||
{ | ||
struct snd_oxfw *oxfw = entry->private_data; | ||
struct snd_oxfw_stream_formation formation, curr; | ||
u8 *format; | ||
char flag; | ||
unsigned int i, err; | ||
|
||
/* Show input. */ | ||
err = snd_oxfw_stream_get_current_formation(oxfw, | ||
AVC_GENERAL_PLUG_DIR_IN, | ||
&curr); | ||
if (err < 0) | ||
return; | ||
|
||
snd_iprintf(buffer, "Input Stream to device:\n"); | ||
snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n"); | ||
for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { | ||
format = oxfw->rx_stream_formats[i]; | ||
if (format == NULL) | ||
continue; | ||
|
||
err = snd_oxfw_stream_parse_format(format, &formation); | ||
if (err < 0) | ||
continue; | ||
|
||
if (memcmp(&formation, &curr, sizeof(curr)) == 0) | ||
flag = '*'; | ||
else | ||
flag = ' '; | ||
|
||
snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag, | ||
formation.rate, formation.pcm, formation.midi); | ||
} | ||
|
||
} | ||
|
||
static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root, | ||
const char *name, | ||
void (*op)(struct snd_info_entry *e, | ||
struct snd_info_buffer *b)) | ||
{ | ||
struct snd_info_entry *entry; | ||
|
||
entry = snd_info_create_card_entry(oxfw->card, name, root); | ||
if (entry == NULL) | ||
return; | ||
|
||
snd_info_set_text_ops(entry, oxfw, op); | ||
if (snd_info_register(entry) < 0) | ||
snd_info_free_entry(entry); | ||
} | ||
|
||
void snd_oxfw_proc_init(struct snd_oxfw *oxfw) | ||
{ | ||
struct snd_info_entry *root; | ||
|
||
/* | ||
* All nodes are automatically removed at snd_card_disconnect(), | ||
* by following to link list. | ||
*/ | ||
root = snd_info_create_card_entry(oxfw->card, "firewire", | ||
oxfw->card->proc_root); | ||
if (root == NULL) | ||
return; | ||
root->mode = S_IFDIR | S_IRUGO | S_IXUGO; | ||
if (snd_info_register(root) < 0) { | ||
snd_info_free_entry(root); | ||
return; | ||
} | ||
|
||
add_node(oxfw, root, "formation", proc_read_formation); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters