[PlanetCCRMA]Re: /dev/midi and pd

Fernando Lopez-Lezcano nando@ccrma.Stanford.EDU
Thu Feb 10 19:16:00 2005


On Thu, 2005-02-10 at 18:14, Jon B wrote:
> > > Yes, I just found that.  So I tried it, but it doesn't work, because
> > > my midiC_D_ files have changed names.
> > >
> > > > There is a way to tell udev to recreate devices automatically on boot
> > > > (it's on the fc3 release notes). Copy the devices from /dev/ to
> > > > /etc/udev/devices/. Again, would be better to alter the creation rules
> > > > or really find the bug :-)
> 
> It seems like I should be figuring out how to change the creation rules...
>  
> > In reality those files should not be links, they should be normal device
> > files (made with mknod). This is what I get on an old rh9 machine:
> > 
> > > ls -l /dev/midi*
> > crw-------    1 nando    root      35,   0 Jan 30  2003 /dev/midi0
> > crw-------    1 nando    root      14,   2 Jan 30  2003 /dev/midi00
> > crw-------    1 nando    root      14,  18 Jan 30  2003 /dev/midi01
> > crw-------    1 nando    root      14,  34 Jan 30  2003 /dev/midi02
> > crw-------    1 nando    root      14,  50 Jan 30  2003 /dev/midi03
> > crw-------    1 nando    root      35,   1 Jan 30  2003 /dev/midi1
> > crw-------    1 nando    root      35,   2 Jan 30  2003 /dev/midi2
> > crw-------    1 nando    root      35,   3 Jan 30  2003 /dev/midi3
> 
> I see this:
> 
> 1. Find the major device number by typing 'cat /proc/devices'. Look
> for the device called "ir", and note its number (it will probably be
> 254 or 253).
> 2. As root, create a character device called '/dev/ir' with that major
> number, using the 'mknod' program.

The "major" number is the first number in the entries above, that is,
for /dev/midi0 the major of the device is 35, the minor number is 0. 

> But are these placed in /dev/ or /etc/udev/devices/ ?  And will they
> always be the same numbers? 

Yes, these should always be the same numbers. 
>From what I've read you can create them in /dev to use them, if you want
them recreated on boot put them in /etc/udev/devices/

>  Can't this be done automatically somehow?

Yes, I still have to read up, that would involve adding rules so that
udev automatically creates the devices on demand. Most probably I could
add this to the alsa-driver package in a future release (until this is
fixed in fcx). 

> These are mine:
> 
> crw-------  1 omegatron root  14, 34 Feb  9 23:50 /dev/snd/midi2
> crw-------  1 omegatron root 116, 72 Feb  9 23:50 /dev/snd/midiC2D0
> crw-------  1 omegatron root 116, 73 Feb  9 23:50 /dev/snd/midiC2D1
> crw-------  1 omegatron root 116, 74 Feb  9 23:50 /dev/snd/midiC2D2
> crw-------  1 omegatron root 116, 75 Feb  9 23:50 /dev/snd/midiC2D3
> 
> but pd is looking for /dev/midi*.  Is there any way to make pd look in
> the other directory?  That might be easier...

Well, they are different things. "/dev/midi*" are the OSS midi devices,
"/dev/snd/midi*" are the ALSA midi devices. When running ALSA (as we
are) the OSS part is handled through emulation modules. Anyway, both
devices are not the same thing, although maybe things will work if you
point one to the other. 

Besides this bug (missing devices in the standard udev configuration in
fc3 - I have to check in redhat's bugzilla to see if this has been
reported before), the _real_ solution would be for pd to use the alsa
sequencer interface to midi devices, instead of the oss raw interface. 

> But then I still have to worry about plugging in a USB device after
> boot or before boot and having the order different...  Argh.

-- Fernando