at the request of mrg, print the parent of audioN's device name
This commit is contained in:
parent
59619cc632
commit
e90b0e0082
@ -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>
|
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
|
||||||
@ -102,7 +102,7 @@ audiodev_getinfo(struct audiodev *adev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
audiodev_add(const char *dev, unsigned int unit)
|
audiodev_add(const char *pdev, const char *dev, unsigned int unit)
|
||||||
{
|
{
|
||||||
struct audiodev *adev;
|
struct audiodev *adev;
|
||||||
|
|
||||||
@ -110,6 +110,7 @@ audiodev_add(const char *dev, unsigned int unit)
|
|||||||
if (adev == NULL)
|
if (adev == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
strlcpy(adev->pxname, pdev, sizeof(adev->pxname));
|
||||||
strlcpy(adev->xname, dev, sizeof(adev->xname));
|
strlcpy(adev->xname, dev, sizeof(adev->xname));
|
||||||
snprintf(adev->path, sizeof(adev->path) - 1, "/dev/%s", dev);
|
snprintf(adev->path, sizeof(adev->path) - 1, "/dev/%s", dev);
|
||||||
adev->unit = unit;
|
adev->unit = unit;
|
||||||
@ -130,9 +131,9 @@ audiodev_add(const char *dev, unsigned int unit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
int
|
||||||
|
@ -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>
|
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
|
||||||
@ -36,7 +36,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct audiodev {
|
struct audiodev {
|
||||||
char xname[16];
|
char pxname[16]; /* hw (parent) device */
|
||||||
|
char xname[16]; /* audio(4) device */
|
||||||
uint16_t unit;
|
uint16_t unit;
|
||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
|
|
||||||
|
@ -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>
|
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
|
||||||
@ -97,7 +97,8 @@ drvctl_get_properties(int fd, const char *devnode, prop_dictionary_t *props)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
drvctl_search(int fd, const char *curnode, const char *dvname,
|
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;
|
struct devlistargs laa;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -120,7 +121,8 @@ drvctl_search(int fd, const char *curnode, const char *dvname,
|
|||||||
rv = prop_dictionary_get_uint32(props,
|
rv = prop_dictionary_get_uint32(props,
|
||||||
"device-unit", &unit);
|
"device-unit", &unit);
|
||||||
if (rv == true)
|
if (rv == true)
|
||||||
callback(args, laa.l_childname[i], unit);
|
callback(args, curnode,
|
||||||
|
laa.l_childname[i], unit);
|
||||||
}
|
}
|
||||||
prop_object_release(props);
|
prop_object_release(props);
|
||||||
|
|
||||||
@ -134,7 +136,8 @@ drvctl_search(int fd, const char *curnode, const char *dvname,
|
|||||||
|
|
||||||
int
|
int
|
||||||
drvctl_foreach(int fd, const char *dvname,
|
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);
|
return drvctl_search(fd, "", dvname, callback, args);
|
||||||
}
|
}
|
||||||
|
@ -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>
|
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
|
||||||
@ -33,6 +33,6 @@
|
|||||||
#include <sys/drvctlio.h>
|
#include <sys/drvctlio.h>
|
||||||
|
|
||||||
int drvctl_foreach(int, const char *,
|
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 */
|
#endif /* !_HAVE_DRVCTL_H */
|
||||||
|
@ -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>
|
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
|
||||||
@ -62,8 +62,9 @@ main(int argc, char *argv[])
|
|||||||
n = audiodev_count();
|
n = audiodev_count();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
adev = audiodev_get(i);
|
adev = audiodev_get(i);
|
||||||
printf("%u: [%c] %s: ",
|
printf("%u: [%c] %s @ %s: ",
|
||||||
i, adev->defaultdev ? '*' : ' ', adev->xname);
|
i, adev->defaultdev ? '*' : ' ',
|
||||||
|
adev->xname, adev->pxname);
|
||||||
printf("%s", adev->audio_device.name);
|
printf("%s", adev->audio_device.name);
|
||||||
if (strlen(adev->audio_device.version) > 0)
|
if (strlen(adev->audio_device.version) > 0)
|
||||||
printf(" %s", adev->audio_device.version);
|
printf(" %s", adev->audio_device.version);
|
||||||
|
Loading…
Reference in New Issue
Block a user