I have an old raspberry B, and I'd like to connect it to a computer with USB. Not for data transmission, but to detect if the computer is turned on. I just want the Pi to do something as soon as that computer is started.
I could use the network, run a ping or arp or whatever to check if the computer is turned on. But that takes time until the Pi recognizes the computer: First, I'd have to run ping in a loop, and I don't want to clutter my network with pings, second, this would only recognize the computer as soon as it has fully booted and established a network connection. I'd like the Pi to recognize the computer as early as possible.
I was thinking about running a USB cable between the computer and the Pi's GPIO pins. Since I can configure the computer to not deliver power when turned off, but then immediately after pressing the power button, it should be possible to just measure if something is connected.
Now, I've already read that I can't just put 5V from USB onto a 3.3V GPIO pin. But what other solution(s) could I use? Can I run the two USB data lines to the Pi to somehow detect if they are "active"? What would be the easiest way check if a USB port supplies power using the Pi? Can I use "common items" like a resistor to get those 5V down to acceptable 3.3V?