Tue Aug 10 13:52:13 2010 UTC ()
Include the type of non-complex pins in the label.


(joerg)
diff -r1.1 -r1.2 src/usr.sbin/hdaudioctl/graph.c

cvs diff -r1.1 -r1.2 src/usr.sbin/hdaudioctl/graph.c (expand / switch to unified diff)

--- src/usr.sbin/hdaudioctl/graph.c 2009/10/11 08:57:54 1.1
+++ src/usr.sbin/hdaudioctl/graph.c 2010/08/10 13:52:13 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: graph.c,v 1.1 2009/10/11 08:57:54 sborrill Exp $ */ 1/* $NetBSD: graph.c,v 1.2 2010/08/10 13:52:13 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> 4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
5 * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> 5 * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Precedence Technologies Ltd 9 * by Precedence Technologies Ltd
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -102,53 +102,71 @@ hdaudioctl_graph(int fd, int argc, char  @@ -102,53 +102,71 @@ hdaudioctl_graph(int fd, int argc, char
102 HDAUDIO_FGRP_WIDGET_INFO, &response); 102 HDAUDIO_FGRP_WIDGET_INFO, &response);
103 if (error != 0) 103 if (error != 0)
104 break; 104 break;
105 prop_dictionary_get_cstring_nocopy(response, "name", &name); 105 prop_dictionary_get_cstring_nocopy(response, "name", &name);
106 prop_dictionary_get_uint32(response, "cap", &cap); 106 prop_dictionary_get_uint32(response, "cap", &cap);
107 prop_dictionary_get_uint32(response, "config", &config); 107 prop_dictionary_get_uint32(response, "config", &config);
108 prop_dictionary_get_uint8(response, "type", &type); 108 prop_dictionary_get_uint8(response, "type", &type);
109 prop_dictionary_get_uint8(response, "nid", &nid); 109 prop_dictionary_get_uint8(response, "nid", &nid);
110 110
111 sprintf(buf, "widget%02Xh", nid); 111 sprintf(buf, "widget%02Xh", nid);
112 112
113 switch (type) { 113 switch (type) {
114 case COP_AWCAP_TYPE_AUDIO_OUTPUT: 114 case COP_AWCAP_TYPE_AUDIO_OUTPUT:
115 printf(" %s [shape=box,style=filled,fillcolor=\"" 115 printf(" %s [label=\"%s\\naudio output\",shape=box,style=filled,fillcolor=\""
116 "#88ff88\"];\n", buf); 116 "#88ff88\"];\n", buf, buf);
117 break; 117 break;
118 case COP_AWCAP_TYPE_AUDIO_INPUT: 118 case COP_AWCAP_TYPE_AUDIO_INPUT:
119 printf(" %s [shape=box,style=filled,fillcolor=\"" 119 printf(" %s [label=\"%s\\naudio input\",shape=box,style=filled,fillcolor=\""
120 "#ff8888\"];\n", buf); 120 "#ff8888\"];\n", buf, buf);
121 break; 121 break;
122 case COP_AWCAP_TYPE_AUDIO_MIXER: 122 case COP_AWCAP_TYPE_AUDIO_MIXER:
123 printf(" %s [shape=invhouse];\n", buf); 123 printf(" %s [label=\"%s\\naudio mixer\","
 124 "shape=invhouse];\n", buf, buf);
124 break; 125 break;
125 case COP_AWCAP_TYPE_AUDIO_SELECTOR: 126 case COP_AWCAP_TYPE_AUDIO_SELECTOR:
126 printf(" %s [shape=invtrapezium];\n", buf); 127 printf(" %s [label=\"%s\\naudio selector\","
 128 "shape=invtrapezium];\n", buf, buf);
127 break; 129 break;
128 case COP_AWCAP_TYPE_PIN_COMPLEX: 130 case COP_AWCAP_TYPE_PIN_COMPLEX:
129 printf(" %s [label=\"%s\\ndevice=%s\",style=filled", 131 printf(" %s [label=\"%s\\ndevice=%s\",style=filled",
130 buf, buf, 132 buf, buf,
131 pin_devices[COP_CFG_DEFAULT_DEVICE(config)]); 133 pin_devices[COP_CFG_DEFAULT_DEVICE(config)]);
132 if (cap & COP_PINCAP_OUTPUT_CAPABLE && 134 if (cap & COP_PINCAP_OUTPUT_CAPABLE &&
133 cap & COP_PINCAP_INPUT_CAPABLE) 135 cap & COP_PINCAP_INPUT_CAPABLE)
134 printf(",shape=doublecircle,fillcolor=\"" 136 puts(",shape=doublecircle,fillcolor=\""
135 "#ffff88\"];\n"); 137 "#ffff88\"];");
136 else if (cap & COP_PINCAP_OUTPUT_CAPABLE) 138 else if (cap & COP_PINCAP_OUTPUT_CAPABLE)
137 printf(",shape=circle,fillcolor=\"#88ff88\"];\n"); 139 puts(",shape=circle,fillcolor=\"#88ff88\"];");
138 else if (cap & COP_PINCAP_INPUT_CAPABLE) 140 else if (cap & COP_PINCAP_INPUT_CAPABLE)
139 printf(",shape=circle,fillcolor=\"#ff8888\"];\n"); 141 puts(",shape=circle,fillcolor=\"#ff8888\"];");
140 else 142 else
141 printf(",shape=circle,fillcolor=\"#888888\"];\n"); 143 puts(",shape=circle,fillcolor=\"#888888\"];");
 144 break;
 145 case COP_AWCAP_TYPE_POWER_WIDGET:
 146 printf(" %s [label=\"%s\\npower widget\","
 147 "shape=box];\n", buf, buf);
 148 break;
 149 case COP_AWCAP_TYPE_VOLUME_KNOB:
 150 printf(" %s [label=\"%s\\nvolume knob\","
 151 "shape=box];\n", buf, buf);
 152 break;
 153 case COP_AWCAP_TYPE_BEEP_GENERATOR:
 154 printf(" %s [label=\"%s\\nbeep generator\","
 155 "shape=box];\n", buf, buf);
 156 break;
 157 case COP_AWCAP_TYPE_VENDOR_DEFINED:
 158 printf(" %s [label=\"%s\\nvendor defined\","
 159 "shape=box];\n", buf, buf);
142 break; 160 break;
143 } 161 }
144 connlist = prop_dictionary_get(response, "connlist"); 162 connlist = prop_dictionary_get(response, "connlist");
145 if (connlist == NULL) 163 if (connlist == NULL)
146 goto next; 164 goto next;
147 iter = prop_array_iterator(connlist); 165 iter = prop_array_iterator(connlist);
148 prop_object_iterator_reset(iter); 166 prop_object_iterator_reset(iter);
149 while ((nnid = prop_object_iterator_next(iter)) != NULL) { 167 while ((nnid = prop_object_iterator_next(iter)) != NULL) {
150 nid = prop_number_unsigned_integer_value(nnid); 168 nid = prop_number_unsigned_integer_value(nnid);
151 printf(" widget%02Xh -> %s [sametail=widget%02Xh];\n", 169 printf(" widget%02Xh -> %s [sametail=widget%02Xh];\n",
152 nid, buf, nid); 170 nid, buf, nid);
153 } 171 }
154 prop_object_iterator_release(iter); 172 prop_object_iterator_release(iter);