title author date CreateTime categories
如何让 USB 设备不显示安全删除硬件弹出选项
lindexi
2019-09-25 11:58:19 +0800
2019-09-25 11:22:23 +0800

插入一个 U 盘的时候,可以在右下角找到安全删除硬件图标,点击就可以删除此硬件。如果此时插入的是一个无线网卡,也就是 USB 无线 wifi 设备,此时如果逗比点了弹出 802.11 设备那么就不能再使用无线上网了
如果我是一个硬件供应商,如何让我的设备不会显示弹出安全删除硬件弹出选项

我不是做硬件的,对硬件懂的很少,以下是我找到的文档,如果有说错的,欢迎小伙伴告诉我

Using the USB Removable Capability for Device Container Grouping

可以找到这句话

The USB Removable capability allows the operating system to create a device container for legacy devices.

Overview of the Removable Device Capability可以知道一个 USB 设备是需要声明自己支持 Removable 的才可以在右下角使用安全删除硬件弹出选项

The removable device capability is a bit (Removable) that bus drivers set in the DEVICE_CAPABILITIES

Container IDs Generated from the Removable Device Capability 可以知道,在即插即用功能将会使用到这个功能,在设备插入的时候,通过发送 IRP_MN_QUERY_CAPABILITIES 获取到设备的返回信息,就可以知道这个设备支不支持移除

The Plug and Play manager uses the removable device capability to generate a container ID for all devnodes enumerated for the physical device. The bus driver reports the removable device capability in response to an IRP_MN_QUERY_CAPABILITIES request.

那么上面说的发送信息是什么,就从IRP_MN_QUERY_CAPABILITIES 可以知道,在硬件设备被枚举时,系统的 PnP 也就是即插即用功能将会发送 IRP_MN_QUERY_CAPABILITIES 信息给到硬件,此时硬件收到时将会回复 DEVICE_CAPABILITIES 信息

When a device is enumerated, but before the function and filter drivers are loaded for the device, the PnP manager sends an IRP_MN_QUERY_CAPABILITIES request to the parent bus driver for the device. The bus driver must set any relevant values in the DEVICE_CAPABILITIES structure and return it to the PnP manager.

硬件回复的消息请看 DEVICE_CAPABILITIES (wdm.h) 在 PnP 询问USB设备,此时USB设备返回 DEVICE_CAPABILITIES 里面可以设置 Removable 项说明此设备支持移除。也就是想要自己的 USB 设备不能被移除,那么就声明不支持移除

以下是 DEVICE_CAPABILITIES 定义

typedef struct _DEVICE_CAPABILITIES {
USHORT Size;
USHORT Version;
ULONG DeviceD1 : 1;
ULONG DeviceD2 : 1;
ULONG LockSupported : 1;
ULONG EjectSupported : 1;
ULONG Removable : 1;
// 忽略不相关属性
} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

对 Removable 属性的官方注释是如果设置为 True 那么将会显示弹出或移除设备

Removable

Specifies whether the device can be dynamically removed from its immediate parent. If Removable is set to TRUE, the device does not belong to the same physical object as its parent.

For example, if Removable is set to TRUE for a USB composite device inside a multifunction printer, the composite device does not belong to the physical object of its immediate parent, such as a USB hub inside a notebook PC.

In most cases the bus driver, not the function driver, should determine the value of the Removable parameter of the device. For USB devices, the USB hub driver sets the Removable parameter. It should not be modified by the function driver.

If Removable is set to TRUE, the device is displayed in the Unplug or Eject Hardware program, unless SurpriseRemovalOK is also set to TRUE.

从可移动设备功能生成的容器 Id 重写

2019-9-25-如何让-USB-设备不显示安全删除硬件弹出选项的更多相关文章

  1. NVIDIA GeForce GTX 960 设备是不可移动的,无法弹出

    系统环境 系统:win7_x64; matlab版本:matlab2017b试用版: GPU:NVIDIA GeForce GTX 960: 问题描述: 第一次使用深度学习实现代码,运行的是matla ...

  2. USB 设备类协议入门【转】

    本文转载自:http://www.cnblogs.com/xidongs/archive/2011/09/26/2191616.html 一.应用场合 USB HID类是比较大的一个类,HID类设备属 ...

  3. Linux系统下查看USB设备名及使用USB设备

    1.系统插入USB设备后,从控制台界面有如下提示: 从控制台信息可以看出插入的USB设备名. 从上图可以看出,插入的USB设备为sde4. 但是,如果是CRT工具远程连接过去,可以使用下面的命令来查看 ...

  4. (三) 查看USB设备

    目录 查看USB设备 lsusb ll /sys/bus/usb/devices cat /sys/kernel/debug/usb/devices dmesg title: 查看USB设备 date ...

  5. Linux下usb设备驱动详解

    USB驱动分为两块,一块是USB的bus驱动,这个东西,Linux内核已经做好了,我们可以不管,我们只需要了解它的功能.形象的说,USB的bus驱动相当于铺出一条路来,让所有的信息都可以通过这条USB ...

  6. USB设备---URB请求块

    1.urb 结构体 USB 请求块(USB request block,urb)是USB 设备驱动中用来描述与USB 设备通信所用的基本载体和核心数据结构,非常类似于网络设备驱动中的sk_buff 结 ...

  7. windodws pyusb hub端口对应连接的usb设备

    源码: 1 #!/usr/bin/python 2 import sys 3 import usb.core 4 # find USB devices 5 dev = usb.core.find(fi ...

  8. Linux自动共享USB设备:udev+Samba

    一.概述 公司最近要我实现USB设备插入Ubuntu后,自动共享到网络上,能像Windows共享一样(如\\192.168.1.10)访问里面的内容,不需要写入权限.当时听完这需求,我这新人表示惊呆了 ...

  9. USB设备(移动硬盘、鼠标)掉电掉驱动的两种解决方案

    症状: 当你发现"移动硬盘图标"经常无故消失,又自己出现时. 你可以把这个现象称之为"掉电" or "掉驱动". 遇到这种情况,相当不爽. ...

  10. AD域控制器通过组策略禁止USB设备

    问题:域环境下如何禁用USB口设备? 第一种:用传统的办法,在Bios中禁用USB. 第二种: 微软技术支持回答:根据您的需求, Windows识别USB设备主要通过两个文件,一个是Usbstor.p ...

随机推荐

  1. 封装tab切换事件

    HTML <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <titl ...

  2. babel基础配置

    babel是干什么的 es6语法已经出来很多年,但各家游览器对es6的支持各不相同.为了解决这个问题,babel应运而生. babel支持把es6语法编译成es5,完全兼容各家游览器,避免兼容性问题出 ...

  3. Python之字典中的键映射多个值

    字典的键值是多个,那么就可以用列表,集合等来存储这些 键值 举例 print({"key":list()}) # {'key': []} print({"key" ...

  4. C语言注意事项

    #include <stdio.h> int main() { /*********************************************** * 指针使用注意事项: * ...

  5. 关于Puppeteer的那些事儿

    最近开始上手一个自动化测试工具Puppeteer,来谈一谈关于它的一些事儿. Puppeteer中文文档:https://zhaoqize.github.io/puppeteer-api-zh_CN/ ...

  6. react 16.3+ 新生命周期

    react 16.3版本出现了两个新的生命周期函数,并将逐渐废弃componentWillMount().componentWillReceiveProps().componentWillUpdate ...

  7. Jmeter请求非Json格式的参数如何添加

    Step1: 可以先在用户自定义变量中加入你需要添加的请求类型,具体参考图片 Step2: 在线程组下请求之前添加HTTP信息头管理器

  8. Java web 应用自启动 shell脚本自动重启

    之前公司的内部管理系统jenkins自动构建代码有时候会失效,导致服务停掉. 于是乎就搞了一个自动启动脚本. oa.jar就是监测的服务 startup.sh 的内容是运行jar包的命令 java - ...

  9. redis的密码设置

    若连接redis时报错:Redis (error) NOAUTH Authentication required.,通常是由于redis设了密码但连接时却未提供密码引起的. 设置密码: 编辑redis ...

  10. 三重循环之break

    while(1) { while(1) { while(1) { break; } } } //逻辑堪比绝技啊 脑洞开之注册表循环遍历方法