Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a lamp that plugs into a USB port. I want to build a program that lets me monitor my internet connection by turning the lamp off when I have no internet connection, and turning it back on when I do.

I have some experience in programming, and I am open to learning. How would I go about doing this?

share|improve this question
    
What operating system are you running? –  kobaltz Aug 24 '12 at 13:51
    
Could you add information regarding the Operating System, the system model, if it's a home-built computer, the motherboard model would be helpful as well. Programming this probably requires interaction with the USB drives, and the above information will help us get the right answer. –  music2myear Aug 24 '12 at 13:52
    
I'm running windows 7 on a fujitsu lifebook N series –  Questioner Aug 24 '12 at 13:55
add comment

2 Answers 2

You probably can't do this, USB decorations such as lamps are not USB devices, they just draw power through a USB connector. My desktop PCs always have power available at their front USB ports, even when the PC is turned off (since PCs lack a true power switch nowadays)

share|improve this answer
add comment

A hacked-up-ghetto solution would be to write a script that would ping 8.8.8.8. If it found a reply then it knows that the usb port needs to be enabled. Have a custom ini file (or any kind of text file) to indicate it's current status. If the ping comes back successfully then check the ini file to see if the port is already enabled. If it is then do nothing. Otherwise run a enable_usb_port.reg script to enable the USB port by modifying the registry. If the ping comes back unsuccessful then you know that either your ping server (8.8.8.8) is down or you have no internet connection. If you find no internet connection then run the disable_usb_port.reg file and update the ini. If the ini already indicates that the port is disabled then do nothing. The enable_usb_port.reg and disable_usb_port.reg is just my naming convention and will need to be built based on the information below. Enable the USB port and then select to export the registry file for that line. Disable the USB port and then export the registry file for that line. This should give you the two ports. You can add a watchdog and/or create a service so that the script will run in the background regardless if the user is logged in or not.

As per the Microsoft knowledge base article 823732 which

contains instructions on how to disable USB storage access

for a certain group of users this disabling and re-enabing

of USB ports is based on a simple registry entry.

To disable the access to USB port, in windows XP and 2000:

  1. Click Start, and then click Run.

  2. In the Open box, type regedit, and then click OK.

  3. Locate, and then click the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\

Services\UsbStor

  1. In the right pane, double-click Start.

  2. In the Value data box, type 4, click Hexadecimal

(if it is not already selected), and then click OK.

  1. Quit Registry Editor.

To re-enable a disabled port:

  1. Click Start, and then click Run.

  2. In the Open box, type regedit, and then click OK.

  3. Locate, and then click the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\

Services\UsbStor

  1. In the right pane, double-click Start.

  2. In the Value data box, type 3, click Hexadecimal

(if it is not already selected), and then click OK.

  1. Quit Registry Editor.

However, there can be other ways too to bypass this issue,

one of the easiest is to invest in a PS2 to USB port convertor.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.