Also, you have to have the 7" display powered via USB cable from the Pi itself, because that is the signaling path by which the touchscreen sends its touch position information back to the Pi. There’s a driver in the Raspberry Pi OS that thinks that incoming USB data is from a mouse.
On the lvgl demo code, my 7" touchscreen is correctly registering my screen touches.
I have connected touchscreen to Pi via USB and it reacts on touch on Raspbian desktop. I also have mouse connected on USB. But when I switch to console (Ctrl+Alt+F1) and run ./demo it does not reacts to any mouse or touchscreen input.