怎么用软件将USB设备软复位?

zxl777 2005-10-18 01:07:10
BusHound 这个USB协议分析软件,其中有一个按钮,按一下可以将USB设备软复位,
PC也会叮咚响一声,和USB设备重新插拔时的发声是一样的。

现在的问题是,有哪个API或方法可以实现相同的效果呢?
...全文
657 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
laogong165 2005-10-18
  • 打赏
  • 举报
回复
学习
rageliu 2005-10-18
  • 打赏
  • 举报
回复
legendhui 2005-10-18
  • 打赏
  • 举报
回复
WM_DEVICECHANGE
The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.

Event = (UINT) wParam;
dwData = (DWORD) lParam;

Parameters
Event
Event type. This parameter can be one of the following values: Value Meaning
DBT_CONFIGCHANGECANCELED A request to change the current configuration (dock or undock) has been canceled.
DBT_CONFIGCHANGED The current configuration has changed, due to a dock or undock.
DBT_DEVICEARRIVAL A device has been inserted and is now available.
DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. Any application can deny this request and cancel the removal.
DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled.
DBT_DEVICEREMOVECOMPLETE A device has been removed.
DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied.
DBT_DEVICETYPESPECIFIC A device-specific event has occurred.
DBT_QUERYCHANGECONFIG Permission is requested to change the current configuration (dock or undock).
DBT_USERDEFINED The meaning of this message is user-defined.


dwData
Address of a structure that contains event-specific data. Its meaning depends on the given event.
legendhui 2005-10-18
  • 打赏
  • 举报
回复
发送WM_DEVICECHANGE消息先带DBT_DEVICEQUERYREMOVE参数模拟拔出
再带DBT_DEVICEARRIVAL参数模拟插入
angel_rabbit 2005-10-18
  • 打赏
  • 举报
回复
关注....
zxl777 2005-10-18
  • 打赏
  • 举报
回复
这个好像是只读的,只是通知应用程序设备发生了什么变化,并不能模拟控制USB设备的插拔。

现在知道用DeviceIoControl发送 IOCTL_INTERNAL_USB_CYCLE_PORT 控制命令可以控制模拟插拔,
但这个好像是DDK的API,不知道怎样调用?
Featured 2005-10-18
  • 打赏
  • 举报
回复
应该是软件禁用、启用一下

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧