Someone please tell me, is it possible to supply external voltage to USB port
and detect this through an application running on the system. or else convert
externally supplied voltage to data and input it to USB so that running application
would detect it.
Can you please try to explain which USB port type at which system you are talking about?
Generally, you have host and device ports which have different roles regarding supply voltage. Also USB devices can be designed as bus-powered or self-powered.
I was referring about USB port of a PC/Laptop. I want to supply voltage from external voltage source to this port.
Is it possible that this voltage could be detected like an mouse click?
I'm not sure what you mean.
If you want to to provide an external power supply instead of the internal USB supply (for example to a 2.5" external HD)
check https://www.edaboard.com/threads/196541/#post824004
You cannot insert a voltage source in the PC USB port, you can only disconnect an external device from the positive supply of the USB plug (the internal one) and then connect an external 5v power supply to that device only , not the pc side
I was referring about USB port of a PC/Laptop. I want to supply voltage from external voltage source to this port.
Is it possible that this voltage could be detected like an mouse click?
So you are talking about a host port. VBUS is connected to the host power supply controller and must not be externally driven. The DC levels of data lines D+ and D- are used to signal device connects and are also not provided for other purposes. The USB host controller of course detects voltage changes, but you won't find an easy way to get this information, I assume. The most easy way to utilize an USB port as input is to connect a HID device interface, then you can acquire the intended information by standard API functions.