Re: libsndio: remove support for legacy device names

2011-05-24 Thread Christopher Zimmermann
On 05/03/11 22:58, Alexandre Ratchov wrote:
 hack to support legacy audio/midi device naming scheme is almost two
 years old, ok to drop support for it?
 
 -- Alexandre


This caught me by surprise. I spent about an hour in gdb and the source
to find out what was wrong.
aucat just told me this:

% aucat -l -f /dev/audio1
aucat: /dev/audio1: can't open device
/dev/audio1: failed to open audio device

I don't know why, but the error message from sio_open about a missing
':' did not come through. This would have helped a lot.

Maybe add a note to faq/current.html?


Christopher



Re: libsndio: remove support for legacy device names

2011-05-24 Thread Paul Irofti
On Tue, May 24, 2011 at 03:18:57PM +0200, Christopher Zimmermann wrote:
 On 05/03/11 22:58, Alexandre Ratchov wrote:
  hack to support legacy audio/midi device naming scheme is almost two
  years old, ok to drop support for it?
  
  -- Alexandre
 
 
 This caught me by surprise. I spent about an hour in gdb and the source
 to find out what was wrong.
 aucat just told me this:
 
 % aucat -l -f /dev/audio1
 aucat: /dev/audio1: can't open device
 /dev/audio1: failed to open audio device
 
 I don't know why, but the error message from sio_open about a missing
 ':' did not come through. This would have helped a lot.
 
 Maybe add a note to faq/current.html?

I couldn't agree more. This needs a bit more visibility.



Re: libsndio: remove support for legacy device names

2011-05-24 Thread Alexandre Ratchov
On Tue, May 24, 2011 at 03:18:57PM +0200, Christopher Zimmermann wrote:
 On 05/03/11 22:58, Alexandre Ratchov wrote:
  hack to support legacy audio/midi device naming scheme is almost two
  years old, ok to drop support for it?
  
  -- Alexandre
 
 
 This caught me by surprise. I spent about an hour in gdb and the source
 to find out what was wrong.
 aucat just told me this:
 
 % aucat -l -f /dev/audio1
 aucat: /dev/audio1: can't open device
 /dev/audio1: failed to open audio device
 
 I don't know why, but the error message from sio_open about a missing
 ':' did not come through. This would have helped a lot.
 
 Maybe add a note to faq/current.html?
 

hm.. this was part of faq/current.html around 2009, but it seems it
was recycled. I'll re-add it

-- Alexandre



libsndio: remove support for legacy device names

2011-05-03 Thread Alexandre Ratchov
hack to support legacy audio/midi device naming scheme is almost two
years old, ok to drop support for it?

-- Alexandre

Index: mio.c
===
RCS file: /cvs/src/lib/libsndio/mio.c,v
retrieving revision 1.10
diff -u -p -r1.10 mio.c
--- mio.c   16 Apr 2011 10:52:22 -  1.10
+++ mio.c   3 May 2011 20:21:39 -
@@ -38,8 +38,7 @@ mio_open(const char *str, unsigned mode,
static char prefix_rmidi[] = rmidi;
static char prefix_aucat[] = aucat;
struct mio_hdl *hdl;
-   struct stat sb;
-   char *sep, buf[4];
+   char *sep;
int len;
 
 #ifdef DEBUG
@@ -57,17 +56,9 @@ mio_open(const char *str, unsigned mode,
}
sep = strchr(str, ':');
if (sep == NULL) {
-   /*
-* try legacy /dev/rmidioxxx device name
-*/
-   if (stat(str, sb)  0 || !S_ISCHR(sb.st_mode)) {
-   DPRINTF(mio_open: %s: missing ':' separator\n, str);
-   return NULL;
-   }
-   snprintf(buf, sizeof(buf), %u, minor(sb.st_rdev));
-   return mio_rmidi_open(buf, mode, nbio);
+   DPRINTF(mio_open: %s: ':' missing in device name\n, str);
+   return NULL;
}
-
len = sep - str;
if (len == (sizeof(prefix_midithru) - 1) 
memcmp(str, prefix_midithru, len) == 0)
Index: sio.c
===
RCS file: /cvs/src/lib/libsndio/sio.c,v
retrieving revision 1.3
diff -u -p -r1.3 sio.c
--- sio.c   3 May 2011 20:15:23 -   1.3
+++ sio.c   3 May 2011 20:21:39 -
@@ -46,8 +46,7 @@ sio_open(const char *str, unsigned mode,
static char prefix_aucat[] = aucat;
static char prefix_sun[] = sun;
struct sio_hdl *hdl;
-   struct stat sb;
-   char *sep, buf[NAME_MAX];
+   char *sep;
int len;
 
 #ifdef DEBUG
@@ -68,15 +67,8 @@ sio_open(const char *str, unsigned mode,
}
sep = strchr(str, ':');
if (sep == NULL) {
-   /*
-* try legacy /dev/audioxxx or ``socket'' device name
-*/
-   if (stat(str, sb)  0 || !S_ISCHR(sb.st_mode)) {
-   snprintf(buf, sizeof(buf), 0.%s, str);
-   return sio_aucat_open(buf, mode, nbio);
-   }
-   snprintf(buf, sizeof(buf), %u, minor(sb.st_rdev)  0xf);
-   return sio_sun_open(buf, mode, nbio);
+   DPRINTF(sio_open: %s: ':' missing in device name\n, str);
+   return NULL;
}
len = sep - str;
if (len == (sizeof(prefix_aucat) - 1)