USB device detection problem on a Raspberry Pi
Try connecting the ground of the RPi to the ground of the keyboard and PC connector. Without a common ground the USB data lines may be exceeding the common-mode range of the RPi's circuits.
If you can't make this ground connection, and you remain convinced that there is a software solution, move your question to a more appropriate forum.