... I notice that I can't use aconnect -d to disconnect it from the physical device.
Following
https://www.geeksforgeeks.org/aconnect-command-in-linux-with-examples/1) Connect using one terminal:
Ok, virtual keyboard connected,
amidi terminal answer to keys of the virtual keyboard.
2) Disconnect using other terminal:
> aconnect -d 130:0 129:0
Virtual keyboard disconnected, no more answer to keys of the virtual keyboard on
amidi but process in first terminal is still running
3) Reconnect using terminal 2):
Ok, virtual keyboard connected,
amidi terminal answer back to keys of the virtual keyboard.
So maybe if using TProcess in thread, one connect with
aconnect 130:0 129:0, a other to disconnect with
aconnect -d 130:0 129:0 + force terminate thread-process one.
(I did not find a command to terminate the
aconnect 130:0 129:0 process, maybe there is no other option than kill it after disconnect.)