[openbeos-midi] Re: How work ioctl?

  • From: "Philippe Houdoin" <philippe.houdoin@xxxxxxx>
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Fri, 10 Jan 2003 09:45:24 +0100 (added by postmaster@wanadoo.fr)

Jerome wrote:
> I'm writing the milestone 3, but I have never use ioctl function. 
> that what I write:
>               FILE *fichier =3D fopen("/dev/midi/ymf754/1", "rw");
>               int file =3D fileno(fichier); //result is 3 seems to be OK

I hope you mean here:

  int fd =3D fileno(fichier);

Or, much simpler:

  int fd =3D open("/dev/midi/ymf754/1", O=5FRDWR | O=5FEXCL);

> uchar *data =3D [0x90 0x39 0x64];
>       midi=5Ftimed=5Fdata DataToSend;
>               DataToSend.when =3D time;
>               DataToSend.size =3D length;
>               DataToSend.data =3D data;
>               int i =3D ioctl(fd, B=5FMIDI=5FTIMED=5FWRITE, &DataToSend, 
> sizeof(midi=5Ftimed=5Fdata));
> Like this in midi=5Fdriver.h
> But I have always i =3D=3D -1 that means an error appear
> If you have an idea

Most probably, the timed read and write API is not supported by current 
BeOS midi drivers.
Since midi2 and his midi=5Fserver, the midi events read & write timing is 
not done anymore (if 
it was ever!!!) by /dev/midi/* drivers but by the midi=5Fserver and 

I'm not sure, but I guess if you try to simply write(fd, data, 3); it 
would works better.
When I worked on a usb=5Fmidi kernel driver, the midi=5Fserver seems to 
never call ioctl(B=5FMIDI=5FTIMED=5F*) on it but simply do loop on read() 
and, eventually, write() to it when an midi event raise.

You may want to ask Oliver about his YMP754 driver MIDI API support, 


Fortune Cookie Says:

Mandrell: "You know what I think?"
Doctor:   "Ah, ah that's a catch question. With a brain your size you
          don't think, right?"
                -- Dr. Who

Other related posts: