blocking snd_rawmidi_read and usb device disconnection

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

 



Hello!

If program is blocked on snd_rawmidi_read and device is disconnected,
it waits infinitely.
Is this an intentional behaviour?

Trying to read ctl device with read() yeilds the same results.

Test programs attached.

Regards,
Dmitry.


P.S. I'm not a subscrber, please cc me in your replies.
#include <alsa/asoundlib.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	int res;
	char c;
	snd_rawmidi_t *m = NULL;
	
	printf("opening %s: ", argv[1]);
	res = snd_rawmidi_open(&m, NULL, argv[1], 0);
	printf("%s\n", snd_strerror(res));
	
	printf("reading: ");
	res = snd_rawmidi_read(m, &c, 1);
	printf("%d\n", res);

	return 0;
}
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	int res;
	int fd;
	char c;

	printf("opening %s: ", argv[1]);
	res = fd = open(argv[1], O_RDONLY);
	printf("%s\n", fd<0 ? strerror(errno) : strerror(0));

	printf("reading: ");
	res = read(fd, &c, 1);
	printf("%d\n", res);

	return 0;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux