是否有软件或代码可以改变 USB 电源输出
我查看了这个和这个,但没有人听起来特别确定他们的想法,无论如何我都在追求另一件事。我想将我的 USB 电源线(红色和黑色)连接到我的手机,这样我就不必使用电池(无论如何电池已经没电了,这只是一个实验)。问题是 USB 标准确保提供至少 4.35V 的电压,而我只需要 3.7V。有谁确定可以或不能以编程方式调节功率输出?我的其他一些疑问是:睡眠模式提供什么样的电源?我需要编写什么代码来实现这个功能,C++?
I had a look at this and this but no one sounded particularly sure of their ideas and I'm kind of after a different thing anyway. I want to hook my usb power cables (red and black) up to my phone so I don't have to use a battery (the battery is dead anyway and this is just an experiment). The problem is that USB standards ensure that a minimum of 4.35V is supplied, when I only want 3.7V. Does anyone know for sure that you can or cannot regulate power output programmatically? Some other queries I have are: What kind of power does the sleep mode provide? And what would I need to code something in to play with this, C++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,您找不到允许您在软件中设置此电压的计算机。它会破坏 USB 规范。
默认情况下,您可以获得 150mA,如果您的 USB 设备与计算机进行协商,则可以获得 500mA(需要设备中的一些逻辑)。乘以 5V 即可获得所提供的功率。
No, you won't find a computer that allows you to set this voltage in software. It would break the USB specification.
You can get 150mA by default, and 500mA if your USB device negotiates it with the computer (requiring a little bit of logic in the device). Multiply by 5V to get the provided power.
有关 Pascal 答案的更多信息:
正常操作(非配置模式)为 100mA
理论上,操作系统应该检查设备配置描述符的 MaxPower 值,以决定是否允许其消耗超过 100mA 的电流。
实际上,个人电脑不会这样做(并且无法控制它)。所以你可以尝试取500mA。
(当然,连接总线供电的集线器并链接多个 500mA 设备应该是行不通的。)
如果设备未被主动使用,操作系统可能(并且应该)挂起它。挂起时,电源限制为 1-0.5mA(理论上,因为它不能由软件控制)。
A bit more info on the answer from Pascal:
The normal operation (Non-Configured mode) is 100mA
In theory, the operating system should check the MaxPower value of the device's configuration descriptor to decide if to allow it to draw more than 100mA.
In practice, PCs do not do it (and have no way to control it). So you can try taking 500mA.
(Of course connecting a bus powered hub and linking more then one 500mA device, should, not work.)
If the device is not actively used, the OS may (and should) suspend it. When suspended the power is limited to 1-0.5mA (Again, in theory, since it can not be controlled by software).