/dev/sequencer is missing + midi programming

batman

New Member
Credits
34
Hi everybody!

I'm trying to learn how to build a software that uses a midi port. I'm a developper so, coding, compiling and testing are not issues. My kernel is Debian 4.19.98 (according to uname -a). I already searched the web and found some "solutions" but none of them solved the problems I have:

/dev/sequencer doesn't exist. I have a /dev/snd/seq, are they the same things ? Who is responsible for creating this device ? Alsa is installed.

I created a link named /dev/sequencer that points to /dev/snd/seq but that doesn't help. I'm now able to open /dev/sequencer but when I try to query the number of midi devices, the call fails:
status = ioctl(seqfd, SNDCTL_SEQ_NRMIDIS, &midiInCount);
ends up with errno=25 (inappropriate ioctl for device). whatever the ioctl code, I always get this error.


A cable usb/midi is used and detected : lsusb shows "Bus 002 Device 003: ID fc08:0101 Conrad Electronic SE MIDI Cable UA0037".
command "aconnect -i" gives (these lines disappear if I unplugged the cable, so this really is my interface):
client 20: 'USB MIDI Interface' [type=kernel,card=1]
0 'USB MIDI Interface MIDI 1'

lsmod shows that the following modules are installed: usb_rawmidi, snd_usb_audio, snd_usbmidi_lib, snd_seq_midi, snd_seq, snd_seq_device.
snd-seq-oss is missing but I don't know how to install it: alsa and alsa-oss are already installed.

Thanks for any tips!
 


LorenDB

Active Member
Credits
1,521
I assume you are running your program as root? Also, if you've got the sources on GitHub/GitLab/... please post a link so that we can easily check out the exact code you're using.
 

batman

New Member
Credits
34
Hi! Thanks for your reply. I tried the program as root and as a common user. Same result.
The code is simple. It was edited for clarity:

#define MIDI_DEVICE "/dev/sequencer"

int midi_init(void)
{
int seqfd;
int status;
int midiInCount = 0;

// open the sequencer device
seqfd = open(MIDI_DEVICE, O_RDONLY);
if (seqfd < 0)
{
printf("Error\n");
exit(1);
}

// read number of inputs available (external MIDI devices only)
status = ioctl(seqfd, SNDCTL_SEQ_NRMIDIS, &midiInCount);
if (status!= 0)
{
printf("Error\n");
exit(1);
}

printf("%d midi input available\n", midiInCount);

close(seqfd);
return 0;
}


As said, I would like to know why /dev/sequencer is missing. Is this really an issue ? I can't load snd-seq-oss module because it's not found. Maybe alsa was built with no sequencer support ? I don't know how to check that. I know nothing about the way midi is managed in Linux, any help is appreciated.
 


Latest posts

Top