关闭电源,USB接口编程 [英] Turn off power to USB Port programmatically

查看:131
本文介绍了关闭电源,USB接口编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我工作的一个项目,我想用这些: http://www.woot.com/blog/post / USB供电,活泉关断灯-2

I have a project that I'm working on and I want to use these: http://www.woot.com/blog/post/usb-powered-woot-off-lights-2

不过看起来他们只是有开/关开关。他们不是东西,你可以用编程接口。

However it looks like they just have on/off switches. They aren't something that you can interface with programmatically.

所以,我在想,如果我能找到一种方法来切断电源到USB端口,这将让我把灯打开和关闭我的应用程序。但是我找不到任何方法来切断电源到USB端口。这可能吗?

So I was thinking, if I could find a way to cut the power to the USB port, that would allow me to turn the lights on and off with my app. However I cant find any way to cut the power to the USB port. Is this possible?

推荐答案

如果您有管理员权限,然后运行以下命令:

If you have admin privileges then run the following:

Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", 开始,4,Microsoft.Win32.RegistryValueKind.DWord);

Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);

这篇关于关闭电源,USB接口编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆