midiin not recieving data from a device

bchkola's icon

Hi,
I have a recurring problem with max and midi-devices, which is driving me insane!
Basically Max (the midiin object) stops being able to receive midi data from a device (MPK mini), if I unplug it from the usb-port and then plug it back again, unless I restart Max. Why??
And even if I bang out a new list of available midi devices and choose "MPK mini" from a umenu, connected to the midiin object, it still doesn't receive the data. And I am certain (well obviously not...) that I'm doing it the right way. When I double click on the midiin object I can see from the dropdown that MPK mini is checked...
And I'm not using the device with any other application that could accidentally claim the port, I'm not even switching between applications while unplugging and replugging the device.

And another thing related to that.
You're supposed to be able to pass a device name as a 'port' parameter, when you create the midiin object so you could make it work specifically with a certain midi-device without having to select the device from a list before it works, right? So in this case you would write [midiin "MPK mini"] or [midiin MPK mini]. This doesn't work for me either...

Did anyone ever experience this problem, or know about how to fix it?

Max Patch
Copy patch and select New From Clipboard in Max.

Here is a small patch with the different setups I'm talking about.