https://blog.csdn.net/qq_36551444/article/details/126028571
https://blog.csdn.net/dream_caoyun/article/details/109340455
https://blog.csdn.net/WenzhenHe/article/details/102625397
https://blog.csdn.net/luoshabugui/article/details/82428500
https://blog.csdn.net/u012846795/article/details/126047189
https://blog.csdn.net/answer966480/article/details/115491083
https://blog.csdn.net/zjgo007/article/details/115172331
https://blog.csdn.net/zhangjinqing1234/article/details/49903613

基本思路是RegisterDeviceNotification注册设备广播,继承QAbstractNativeEventFilter,并重写nativeEventFilter方法。但是实际实践过程中nativeEventFilter并没有回调(可能实现类不是Window或者Dialog的原因),但是Window的nativeEvent方法有回调,将其方法回调至工具类中实现nativeEventFilter方法即可监听usb.

串口插拔监听

https://blog.csdn.net/ifeng12358/article/details/128264783

问题

  • 集成Dt.h后报"DWORD" does named a type
    解决方法:
    方法一 :
    main.cpp中加上

    include

    方法二:
    在报错的前面一行加上:
    typedef unsigned long DWORD;
    注:不要两种同时使用,否则会重定义。

  • fastboot设备识别
    但是上面的方法只能监听到USB设备的插拔,如果usb设备切换成fastboot设备,则没有明确的回调。只能通过进一步调用fastboot命令来确定。

分类: usb

0 条评论

发表回复

您的电子邮箱地址不会被公开。