snd_ctl_open and snd_rawmidi_open conflict

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

 



Hello!

I'm writing a program that have to open all rawmidi ports, and
periodically remove nonexisting ones, and open new ones (read, deal
with usb-midi connect/disconnect).

For example, we have USB-midi interface with 2 ports: hw:1,0,0 and hw:1,0,1
To get the list, I make snd_ctl_open("hw:1), then walk through
devices/subdevices and try to open all rawmidi ports. The problem is,
that I can only open first one - hw:1,0,0, trying to open another
gives "Device or resource is busy".

If I do NOT have ctl opened, I can open all subdevices without trouble.

Another releated question is: how can I detect connection of a new
usb-midi device?
For now I use inotify on /dev/snd, but it's a kludge, cause I have to
add sleep(1) before actual rescan of devices, or I miss the update.

Best regards,
Dmitry.

P.S. Im not a subscriber, please cc me in your replies

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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