Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audiocfg at the request of mrg, print the parent of ...



details:   https://anonhg.NetBSD.org/src/rev/9e73149441ab
branches:  trunk
changeset: 757524:9e73149441ab
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 02 02:17:35 2010 +0000

description:
at the request of mrg, print the parent of audioN's device name

diffstat:

 usr.bin/audiocfg/audiodev.c |   9 +++++----
 usr.bin/audiocfg/audiodev.h |   5 +++--
 usr.bin/audiocfg/drvctl.c   |  11 +++++++----
 usr.bin/audiocfg/drvctl.h   |   4 ++--
 usr.bin/audiocfg/main.c     |   7 ++++---
 5 files changed, 21 insertions(+), 15 deletions(-)

diffs (134 lines):

diff -r e5ee72bef08d -r 9e73149441ab usr.bin/audiocfg/audiodev.c
--- a/usr.bin/audiocfg/audiodev.c       Thu Sep 02 02:08:30 2010 +0000
+++ b/usr.bin/audiocfg/audiodev.c       Thu Sep 02 02:17:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.2 2010/09/01 09:04:16 jmcneill Exp $ */
+/* $NetBSD: audiodev.c,v 1.3 2010/09/02 02:17:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -102,7 +102,7 @@
 }
 
 static int
-audiodev_add(const char *dev, unsigned int unit)
+audiodev_add(const char *pdev, const char *dev, unsigned int unit)
 {
        struct audiodev *adev;
 
@@ -110,6 +110,7 @@
        if (adev == NULL) 
                return -1;
 
+       strlcpy(adev->pxname, pdev, sizeof(adev->pxname));
        strlcpy(adev->xname, dev, sizeof(adev->xname));
        snprintf(adev->path, sizeof(adev->path) - 1, "/dev/%s", dev);
        adev->unit = unit;
@@ -130,9 +131,9 @@
 }
 
 static void
-audiodev_cb(void *args, const char *dev, unsigned int unit)
+audiodev_cb(void *args, const char *pdev, const char *dev, unsigned int unit)
 {
-       audiodev_add(dev, unit);
+       audiodev_add(pdev, dev, unit);
 }
 
 int
diff -r e5ee72bef08d -r 9e73149441ab usr.bin/audiocfg/audiodev.h
--- a/usr.bin/audiocfg/audiodev.h       Thu Sep 02 02:08:30 2010 +0000
+++ b/usr.bin/audiocfg/audiodev.h       Thu Sep 02 02:17:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.h,v 1.2 2010/09/01 09:04:16 jmcneill Exp $ */
+/* $NetBSD: audiodev.h,v 1.3 2010/09/02 02:17:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -36,7 +36,8 @@
 #include <stdbool.h>
 
 struct audiodev {
-       char xname[16];
+       char pxname[16];        /* hw (parent) device */
+       char xname[16];         /* audio(4) device */
        uint16_t unit;
        char path[PATH_MAX+1];
 
diff -r e5ee72bef08d -r 9e73149441ab usr.bin/audiocfg/drvctl.c
--- a/usr.bin/audiocfg/drvctl.c Thu Sep 02 02:08:30 2010 +0000
+++ b/usr.bin/audiocfg/drvctl.c Thu Sep 02 02:17:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.1.1.1 2010/08/30 02:19:47 mrg Exp $ */
+/* $NetBSD: drvctl.c,v 1.2 2010/09/02 02:17:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -97,7 +97,8 @@
 
 static int
 drvctl_search(int fd, const char *curnode, const char *dvname,
-    void (*callback)(void *, const char *, unsigned int), void *args)
+    void (*callback)(void *, const char *, const char *, unsigned int),
+    void *args)
 {
        struct devlistargs laa;
        unsigned int i;
@@ -120,7 +121,8 @@
                        rv = prop_dictionary_get_uint32(props,
                            "device-unit", &unit);
                        if (rv == true)
-                               callback(args, laa.l_childname[i], unit);
+                               callback(args, curnode,
+                                   laa.l_childname[i], unit);
                }
                prop_object_release(props);
 
@@ -134,7 +136,8 @@
 
 int
 drvctl_foreach(int fd, const char *dvname,
-    void (*callback)(void *, const char *, unsigned int), void *args)
+    void (*callback)(void *, const char *, const char *, unsigned int),
+    void *args)
 {
        return drvctl_search(fd, "", dvname, callback, args);
 }
diff -r e5ee72bef08d -r 9e73149441ab usr.bin/audiocfg/drvctl.h
--- a/usr.bin/audiocfg/drvctl.h Thu Sep 02 02:08:30 2010 +0000
+++ b/usr.bin/audiocfg/drvctl.h Thu Sep 02 02:17:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.h,v 1.1.1.1 2010/08/30 02:19:47 mrg Exp $ */
+/* $NetBSD: drvctl.h,v 1.2 2010/09/02 02:17:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,6 +33,6 @@
 #include <sys/drvctlio.h>
 
 int    drvctl_foreach(int, const char *,
-                      void (*)(void *, const char *, unsigned int), void *);
+           void (*)(void *, const char *, const char *, unsigned int), void *);
 
 #endif /* !_HAVE_DRVCTL_H */
diff -r e5ee72bef08d -r 9e73149441ab usr.bin/audiocfg/main.c
--- a/usr.bin/audiocfg/main.c   Thu Sep 02 02:08:30 2010 +0000
+++ b/usr.bin/audiocfg/main.c   Thu Sep 02 02:17:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.4 2010/09/02 02:08:30 jmcneill Exp $ */
+/* $NetBSD: main.c,v 1.5 2010/09/02 02:17:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -62,8 +62,9 @@
                n = audiodev_count();
                for (i = 0; i < n; i++) {
                        adev = audiodev_get(i);
-                       printf("%u: [%c] %s: ",
-                           i, adev->defaultdev ? '*' : ' ', adev->xname);
+                       printf("%u: [%c] %s @ %s: ",
+                           i, adev->defaultdev ? '*' : ' ',
+                           adev->xname, adev->pxname);
                        printf("%s", adev->audio_device.name);
                        if (strlen(adev->audio_device.version) > 0)
                                printf(" %s", adev->audio_device.version);



Home | Main Index | Thread Index | Old Index