[BUG] 2.6.16-rc4 git, ALSA USB-MIDI does not give NOTEOFF event for M-Audio Keystation 88es, but NOTEON with velocity=0

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

 



Hi,

I'm seeing that USB MIDI keyboard (M-Audio Keystation 88es) is
generating note-on events on both note-on and note-off. The difference
being that note-off is generating an note-on event with velocity '0'.

The following code in seq_midi_emul.c(snd_midi_process_event) looks
suspiciously like what's needed for this device:

        /* Make sure that we don't have a note on that should really be
         * a note off */
        if (ev->type == SNDRV_SEQ_EVENT_NOTEON && ev->data.note.velocity == 0)
                ev->type = SNDRV_SEQ_EVENT_NOTEOFF;


I'm not sure if this is something hardware-specific or not.

$ uname -a 
Linux dancer64 2.6.16-rc4dancer-g9e956c2d-dirty #1 Thu Feb 23 22:06:47 JST 2006 x86_64 GNU/Linux


$ ./seqdump.c # this program is attached the end of the mail.
noteon 0 3c 4e
noteon 0 3c 0
noteon 0 3e 4d
noteon 0 3e 0
noteon 0 40 54
noteon 0 40 0
noteon 0 41 4f
noteon 0 41 0
noteon 0 45 4c
noteon 0 45 0
noteon 0 43 4f
noteon 0 43 0
noteon 0 41 56
noteon 0 41 0
noteon 0 40 4f
noteon 0 40 0
noteon 0 3e 4c
noteon 0 3e 0

$ lsusb -s3:7 -v

Bus 003 Device 007: ID 0763:0192 Midiman 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0763 Midiman
  idProduct          0x0192 
  bcdDevice            1.25
  iManufacturer           1 M-Audio
  iProduct                2 USB Keystation 88es
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          101
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3 Audio Class
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength            9
        bInCollection           1
        baInterfaceNr( 0)       1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           65
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
Device Status:     0x0000
  (Bus Powered)


$ lsmod
Module                  Size  Used by
snd_usb_audio          89280  0 
snd_usb_lib            17856  1 snd_usb_audio
snd_hwdep              11720  1 snd_usb_audio
snd_seq_dummy           4484  0 
snd_seq_oss            36260  0 
snd_seq_midi            9920  0 
snd_rawmidi            28768  2 snd_usb_lib,snd_seq_midi
snd_seq_midi_event      8384  2 snd_seq_oss,snd_seq_midi
snd_seq                56600  9 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_seq_device         10320  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
ipt_recent             11736  2 
ip_nat_irc              3200  0 
ip_nat_ftp              4352  0 
ip_conntrack_irc        7840  1 ip_nat_irc
ip_conntrack_ftp        8872  1 ip_nat_ftp
xt_state                2560  3 
ipt_MASQUERADE          3904  1 
ipt_LOG                 7296  7 
iptable_mangle          3392  0 
ipt_TCPMSS              4800  0 
xt_tcpmss               3072  0 
xt_tcpudp               3968  2 
iptable_filter          3584  1 
iptable_nat             9412  1 
ip_nat                 19576  4 ip_nat_irc,ip_nat_ftp,ipt_MASQUERADE,iptable_nat
ip_tables              13728  3 iptable_mangle,iptable_filter,iptable_nat
ip_conntrack           55368  8 ip_nat_irc,ip_nat_ftp,ip_conntrack_irc,ip_conntrack_ftp,xt_state,ipt_MASQUERADE,iptable_nat,ip_nat
x_tables               15176  9 ipt_recent,xt_state,ipt_MASQUERADE,ipt_LOG,ipt_TCPMSS,xt_tcpmss,xt_tcpudp,iptable_nat,ip_tables
pppoe                  15936  2 
pppox                   4432  1 pppoe
af_packet              23756  4 
tsdev                   9280  0 
pcspkr                  3848  0 
tuner                  57644  0 
bttv                  207164  0 
video_buf              25156  1 bttv
compat_ioctl32          9856  1 bttv
v4l2_common             9984  3 tuner,bttv,compat_ioctl32
btcx_risc               5768  1 bttv
ir_common              11076  1 bttv
tveeprom               18064  1 bttv
videodev               12096  1 bttv
snd_atiixp             21592  0 
snd_ac97_codec        108668  1 snd_atiixp
snd_ac97_bus            2944  1 snd_ac97_codec
snd_pcm_oss            57056  0 
snd_mixer_oss          19328  1 snd_pcm_oss
snd_pcm                98060  4 snd_usb_audio,snd_atiixp,snd_ac97_codec,snd_pcm_oss
snd_timer              25736  2 snd_seq,snd_pcm
snd                    64384  15 snd_usb_audio,snd_usb_lib,snd_hwdep,snd_seq_dummy,snd_seq_oss,snd_rawmidi,snd_seq,snd_seq_device,snd_atiixp,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
snd_page_alloc         12240  2 snd_atiixp,snd_pcm
generic                 5764  0 [permanent]
shpchp                 49216  0 
pci_hotplug            12548  1 shpchp
ide_scsi               18244  0 
psmouse                42376  0 
rtc                    14392  0 
unix                   31096  419 




regards,
	junichi
-- 
dancer@{debian.org,netfort.gr.jp}   Debian Project

===File ~/cvscheckout/whole/danceraudiotools/seqmidi/seqdump.c===
/*BINFMTC: -lasound


Connects to ALSA sequencer port and dumps NOTE ON and NOTE OFF events.

 */

#include <stdio.h>
#include <alsa/asoundlib.h>


int main(int argc, char **argv)
{
  snd_seq_t *seq;
  int err;
  int port;
  snd_seq_event_t *ev;  
  
  err=snd_seq_open(&seq, "default", SND_SEQ_OPEN_INPUT, 0);
  if (err < 0)
    {
      fprintf(stderr, "Cannot open default sequencer port\n");
      return 1;
    }
  snd_seq_set_client_name(seq, "Dancer Midi Seqdump");  
  port = snd_seq_create_simple_port(seq, "input port1",
				    SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
				    SND_SEQ_PORT_TYPE_APPLICATION);
  if (port < 0)
    {
      fprintf(stderr, "Cannot open port\n");
      return 1;
    }

  while (snd_seq_event_input(seq, &ev) >= 0)
    {
      switch (ev->type)
	{
	case SND_SEQ_EVENT_NOTEON:
	  printf("noteon %x %x %x\n", ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
	  break;
	  
	case SND_SEQ_EVENT_NOTEOFF:
	  printf("noteoff %x %x %x\n", ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
	  break;
	}
    }
}
============================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux