FalconChristmas / fpp-midi

FPP MIDI Plugin
GNU General Public License v2.0
1 stars 0 forks source link

FPPV8: Midi plugin UI does not display the midi device(s) #3

Closed patdelaney closed 3 weeks ago

patdelaney commented 5 months ago

FPPv8 master on Raspberry Pi v3+

When I plug in the midi device, it is not reflected in the FPP Plugin UI. (see Picture)

image

If I ssh into the Pi and run aseqdump -l I get the following, so the operating system sees it.

fpp@FPPv3p-1:~ $ aseqdump -l
 Port    Client name                      Port name
  0:0    System                           Timer
  0:1    System                           Announce
 14:0    Midi Through                     Midi Through Port-0
 24:0    LPD8                             LPD8 MIDI 1

If I run aseqdump -p LPD8 from the ssh session, the device is sending commands.

fpp@FPPv3p-1:~ $ aseqdump -p LPD8
Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
 24:0   Note on                 0, note 40, velocity 14
 24:0   Note off                0, note 40, velocity 127
 24:0   Note on                 0, note 40, velocity 10
 24:0   Note off                0, note 40, velocity 127
 24:0   Note on                 0, note 36, velocity 11
 24:0   Note off                0, note 36, velocity 127
 24:0   Note on                 0, note 36, velocity 26
 24:0   Note off                0, note 36, velocity 127
 24:0   Note on                 0, note 36, velocity 4
 24:0   Note off                0, note 36, velocity 127

Let me know if you need anything else

I turned up logging levels and no errors found

patdelaney commented 5 months ago

Here is the output of the install script:

Installing plugin fpp-midi
Cloning into 'fpp-midi'...
Running fpp_install.sh script for fpp-midi
Building FPP on 'Raspberry Pi' platform
sudo ./install_librtmidi.sh
Get:1 http://archive.raspberrypi.com/debian bookworm InRelease [23.6 kB]
Get:2 http://raspbian.raspberrypi.com/raspbian bookworm InRelease [15.0 kB]
Get:3 http://archive.raspberrypi.com/debian bookworm/main armhf Packages [383 kB]
Get:4 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf Packages [14.5 MB]
Get:5 http://archive.raspberrypi.com/debian bookworm/main arm64 Packages [374 kB]
Fetched 15.3 MB in 11s (1,360 kB/s)
Reading package lists...
W: http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package librtmidi5
Get:1 https://mirrors.gigenet.com/raspbian/raspbian bookworm/main armhf librtmidi-dev armhf 5.0.0-3 [40.9 kB]
Fetched 40.9 kB in 1s (57.0 kB/s)
dpkg-deb: building package 'librtmidi-dev' in './librtmidi-dev.deb'.
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 librtmidi-dev : Depends: librtmidi5 but it is not installable
E: Unable to correct problems, you have held broken packages.
librtmidi-dev set on hold.
ccache g++ -fpch-preprocess -O3 -Wno-psabi -pipe -I /opt/fpp/src -fpic -DPLATFORM_PI -I. -std=gnu++23  -c src/FPPMIDI.cpp -o src/FPPMIDI.o
src/FPPMIDI.cpp:22:10: fatal error: rtmidi/RtMidi.h: No such file or directory
   22 | #include <rtmidi/RtMidi.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:25: src/FPPMIDI.o] Error 1
{"Status":"Error","Message":"Could not properly install plugin"}
patdelaney commented 5 months ago

looking at the install script and comparing it to what is in bookworm, there is no librtmidi5 but there is a librtmidi6 http://192.168.1.148/api/plugin-apis/MIDI/Devices the api returns none found I think you mentioned that could be the issue in slack

zaicik commented 2 months ago

Hey @patdelaney Your problem is actually with the install script being broken. When installation proceeds properly, the midi devices show up correctly. I just documented the issue and a proposed fix there: https://github.com/FalconChristmas/fpp-midi/issues/6

In the meantime, you can work your way around manually:

=> if it's already/still there, uninstall the Midi plugin

=> Copy this updates script and save it as fpp_install_librtmidi-FIX.sh (or any other name, up to you)


cd /tmp
rm -rf librtmidi-*
apt-get -q -y update

DEBVERF=$(cat /etc/debian_version)
DEBVER=${DEBVERF%.*}
if (( DEBVER < 11 )); then
apt-get -q -y --reinstall install librtmidi4
elif (( DEBVER < 12 )); then
apt-get -q -y --reinstall install librtmidi5
else
apt-get -q -y --reinstall install librtmidi6
fi
apt-get clean
apt-get download librtmidi-dev
rm -rf deb
mkdir deb
dpkg-deb -R ./librtmidi-dev*.deb  deb
sed -i -e "s/Version\(.*\)/Version\1~fpp/g" deb/DEBIAN/control

if (( DEBVER < 11 )); then
sed -i -e "s/Depends: \(.*\)/Depends: librtmidi4/g" deb/DEBIAN/control
elif (( DEBVER < 12 )); then
sed -i -e "s/Depends: \(.*\)/Depends: librtmidi5/g" deb/DEBIAN/control
else 
sed -i -e "s/Depends: \(.*\)/Depends: librtmidi6/g" deb/DEBIAN/control
fi
dpkg-deb -b deb ./librtmidi-dev.deb
apt-get -y --reinstall --allow-change-held-packages install ./librtmidi-dev.deb
apt-mark hold librtmidi-dev
apt-get clean
rm -rf deb

echo "\n\n##################################\n##  Done ! You can now install  ##\n##   the midi plugin normally   ##\n##################################"```

**=> Go to FPP's `File Manager`>`Scripts`, upload and run the script**

**=> Go to `Plugin Manager` and install the Midi plugin normally**

Note on security: 
You should never just trust a stranger and run a script no one has vetted, so kindly take a couple of minutes to review what I fixed compared to the original here: [https://github.com/FalconChristmas/fpp-midi/blob/master/install_librtmidi.sh](url)
(the bug was in `line 24`, and there was a non-blocking problem in `line 20` that I fixed so it does what it's meant to do, aka renaming that version of `librtmidi-dev`)

Cheers !
patdelaney commented 3 weeks ago

This is no longer an issue in FPP 8, it worked in FPP7 as well