* Strange err=25 result.
@ 2004-01-14 14:09 James Courtier-Dutton
2004-01-14 14:12 ` Jaroslav Kysela
0 siblings, 1 reply; 3+ messages in thread
From: James Courtier-Dutton @ 2004-01-14 14:09 UTC (permalink / raw)
To: alsa-devel
Some debug output from calling snd_pcm_wait() when a USB device is
unplugged.
(pcm_hw.c from /alsa-lib/src/pcm/pcm_hw.c)
file=pcm_hw.c:406 function=snd_pcm_hw_status err=25
pcm_hw.c: snd_pcm_hw_status() SNDRV_PCM_IOCTL_STATUS failed.
According to errno.h,
#define ENOTTY 25 /* Not a typewriter */
I would think that the following would be a better err result.
#define ENODEV 19 /* No such device */
or even
#define EPIPE 32 /* Broken pipe */
I have looked through alsa-lib and alsa-kernel and cannot find any place
in the code that sets errno to 25!
Can anybody help?
My aim is to let the application detect when a usb audio device is
unplugged, so that the application can release all alsa resources.
The application will then poll the alsa-lib trying to open the device
again, and continually get errors until the audio usb device is plugged
in again. For my application to achieve this, I would need a specific
errno for the "usb device unplugged" that will not get confused with
over/underruns or other errors that might not be "usb unplugged" related.
Cheers
James
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange err=25 result.
2004-01-14 14:09 Strange err=25 result James Courtier-Dutton
@ 2004-01-14 14:12 ` Jaroslav Kysela
2004-01-15 0:50 ` James Courtier-Dutton
0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2004-01-14 14:12 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: alsa-devel
On Wed, 14 Jan 2004, James Courtier-Dutton wrote:
> Some debug output from calling snd_pcm_wait() when a USB device is
> unplugged.
>
> (pcm_hw.c from /alsa-lib/src/pcm/pcm_hw.c)
> file=pcm_hw.c:406 function=snd_pcm_hw_status err=25
> pcm_hw.c: snd_pcm_hw_status() SNDRV_PCM_IOCTL_STATUS failed.
>
> According to errno.h,
> #define ENOTTY 25 /* Not a typewriter */
>
> I would think that the following would be a better err result.
> #define ENODEV 19 /* No such device */
> or even
> #define EPIPE 32 /* Broken pipe */
>
> I have looked through alsa-lib and alsa-kernel and cannot find any place
> in the code that sets errno to 25!
>
> Can anybody help?
Consult the toplevel filesystem routines. In case when the device is
disconnected, all i/o (filesystem operation) calls are redirected to empty
structure, so the Linux kernel filesystem code probably returns ENOTTY
errors when no ioctl/read/write callbacks are associated to the device.
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange err=25 result.
2004-01-14 14:12 ` Jaroslav Kysela
@ 2004-01-15 0:50 ` James Courtier-Dutton
0 siblings, 0 replies; 3+ messages in thread
From: James Courtier-Dutton @ 2004-01-15 0:50 UTC (permalink / raw)
To: Jaroslav Kysela; +Cc: alsa-devel
Jaroslav Kysela wrote:
> On Wed, 14 Jan 2004, James Courtier-Dutton wrote:
>
>
>>Some debug output from calling snd_pcm_wait() when a USB device is
>>unplugged.
>>
>>(pcm_hw.c from /alsa-lib/src/pcm/pcm_hw.c)
>>file=pcm_hw.c:406 function=snd_pcm_hw_status err=25
>>pcm_hw.c: snd_pcm_hw_status() SNDRV_PCM_IOCTL_STATUS failed.
>>
>>According to errno.h,
>>#define ENOTTY 25 /* Not a typewriter */
>>
>>I would think that the following would be a better err result.
>>#define ENODEV 19 /* No such device */
>>or even
>>#define EPIPE 32 /* Broken pipe */
>>
>>I have looked through alsa-lib and alsa-kernel and cannot find any place
>>in the code that sets errno to 25!
>>
>>Can anybody help?
>
>
> Consult the toplevel filesystem routines. In case when the device is
> disconnected, all i/o (filesystem operation) calls are redirected to empty
> structure, so the Linux kernel filesystem code probably returns ENOTTY
> errors when no ioctl/read/write callbacks are associated to the device.
>
> Jaroslav
Thank you, that makes sense. :-)
Also, what should
snd_pcm_wait()
and
snd_pcm_state()
return if the USB device is unplugged.
At the moment, snd_pcm_wait() just hangs around until the timeout and
returns errno -5
and snd_pcm_state() still returns state=3 which is SND_PCM_STATE_RUNNING
I would hardly say the the card is still in "RUNNING" state if you
physically remove the card from the system!
I would prefer snd_pcm_wait() to imeadiately exit with an errno, and
snd_pcm_state() to return a new state of "SND_PCM_STATE_DISCONNECTED" or
similar.
Can I do what I want with snd_pcm_wait or not?
Cheers
James
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-15 0:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-14 14:09 Strange err=25 result James Courtier-Dutton
2004-01-14 14:12 ` Jaroslav Kysela
2004-01-15 0:50 ` James Courtier-Dutton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.