There appears to be a bug in the Linux version or Reaper, whereby MIDI-in on some M-Audio does not function when ALSA is selected as the Audio System in Preferences/Audio/Device. MIDI-out and audio does work, but MIDI in from an external keyboard connected to the sound-card's MIDI-IN port fails to register.
This has been confirmed with the following models: M-Audio 2496 and M-Audio Audiophile 192 sound cards with built in MIDI interfaces.
A work-around is to set the audio system to "JACK" under "Preferences/Audio/Device/Audio System" and specify the following launch command under "Auto-Start jackd":
/usr/bin/jackd -P80 -dalsa -dhw:<soundcard name>,0 -r44100 -p64 -n2 -Xseq
See thread here discussing this here:
https://forum.cockos.com/showthread....64#post2158164
My specs:
Lubuntu 16.04.6LTS
Reaper version 5.980 (Linux X86_64)
M-Audio audiophile 192 soundcard