Что такое принцип и как работает Plug and Play?
Что такое и как работает Plug and Play ?
Когда вы включаете операционную систему, поддерживающую принцип Plug and Play (дословно с английского означает “подключил и заработало”), первостепенным арбитром, ответственным за слаженную работу Windows и «железо» ПК является, как, вы уже знаете, BIOS. Этот принцип, конечно, одинаков для всех ОС с пользовательским интерфейсом. Она, Windows, изыскивает оборудование в чреве компьютера на предмет правильности работы и минимального его набора для корректного исполнения возлагаемых задач со стороны пользователя. BIOS определяет эти устройства, основываясь на их индивидуальных показателях (идентификаторах) – кусочках кода, которые прошиты в чипы памяти устройств. После считывания информации об устройстве, BIOS передаёт контроль Windows. Это вы тоже знаете.
Plug and Play . Что дальше?
Для понимания дальнейших процессов введём ещё пару понятий. В работу вступает специальный инструмент операционной системы – конфигуратор Windows. Настоящее его название модуль управления конфигурацией. В Windows именно он отвечает за ведение системного реестра – спинного мозга системы. Так вот, это самый конфигуратор добавляет к своим же записям драйверы специальных устройств, которые называются нумераторы. Нумератор – программка, которая выполняет роль интерфейса между операционной системой и каким-то устройством. Существуют нумераторы шин, портов, специальной шины SCSI (интерфейс малой компьютерной системы) и множество других. Windows во время работы постоянно опрашивает нумераторы об идентификации устройства, с которым нумератор будет работать, и что этому устройству будет необходимо для работы.
Собрав всю информацию с нумераторов, система записывает её на хранение в дерево аппаратных средств – базу данных, хранящихся в оперативной памяти. Сразу после этого необходимо проверить дерево на отсутствие аппаратных конфликтов. Попросту говоря, для каждого устройства должно работать своё прерывание, своя «ирка». Windows и принимает решение, какое из прерываний для какого из устройств назначить. Нумераторы просто сохраняют эту информацию (информацию о распределении ресурсов) в программируемых регистрах (ячейках кэш-памяти чипов).
Наконец, система начинает искать подходящий для каждого из устройств драйвер. Драйвер, напомню, это кусок кода, который сообщает системе информацию об устройстве. Если Windows не находит драйвер, она сразу пытается его установить. Когда драйверы загружены, система сообщает устройству через его драйвер, какими ресурсами пользоваться. Драйвер включает в работу своё устройство, система полностью загрузилась. Вы увидели вплывающее окно, которое гласит: “Устройство установлено и готово к использованию”. Можно работать.
Вот как описывает принцип Plug and Play Microsoft в пояснениях к схеме:
Исходное состояние После того, как управляющая программа Plug and Play привязала необходимые аппаратные ресурсы к устройству, она посылает пакет запроса ввода-вывода (IRP), указывая, что все драйверы устройства приведены в состояние боевой готовности. Устройство могло быть только что установлено и запускается впервые, а может было перезапущено после остановки в его работе при повторном балансировании элементов интерфейса системы (под лихо закрученной последней фразой понимается пероформление, например, списка устройств в окне Мой компьютер при добавлении нового устройства к системе).
Подготовка к отключению Управляющая программа Plug and Play посылает запрос драйверу, чтобы тот убрал из системы программное обеспечение удаляемого устройства. Система это делает в тот момент, когда пользователь удаляет устройство с помощью функции “Удаление устройства из системы”, щёлкая по значку в трее, сразу и без предупреждения выдёргивает шнур USB из гнезда или пытается обновить драйверы устройства.
Немедленное (внзапное) отключение Ууправляющая программа Plug and Play посылает запрос драйверу, оповещая его, что устройство удалено из системы. В ответ драйвер прекращает подачу питания на устройство и предпринимает дополнительные (если необходимо) меры по удалению устройства
Подготовка к удалению Управляющая программа Plug and Play посылает запрос драйверу, может ли он сейчас остановить устройство. Если все загруженные для этого устройства драйверы отвечают утвердительно, они же и вводят устройство в состояние “Устройство может быть удалено”.
Состояние “Выключено” Управляющая программа Plug and Play держит драйверы устройства в состоянии готовности ко включению.
Introduction to Plug and Play
This section contains the following additional topics:
Plug and Play (PnP) is the part of Windows that enables a computer system to adapt to hardware changes with minimal intervention by the user. A user can add and remove devices without having to do manual configuration, and without knowledge of computer hardware. For example, a user can dock a portable computer and use the docking station keyboard, mouse, and monitor without making manual configuration changes.
PnP requires support from device hardware, system software, and drivers. Initiatives in the hardware industry define standards for easy identification of add-in boards and system components. This Windows Driver Kit (WDK) documentation focuses on the system software support for PnP and how drivers use that support to implement PnP.
The system software support for PnP, together with PnP drivers provides the following:
Automatic and dynamic recognition of installed hardware
Hardware resource allocation (and reallocation)
The PnP manager determines the hardware resources requested by each device (for example, input/output ports, interrupt requests, direct memory access channels, and memory locations) and assigns hardware resources appropriately. The PnP manager reconfigures resource assignments when necessary, such as when a new device is added to the system that requires resources already in use.
Drivers for PnP devices do not assign resources; instead, the requested resources for a device are identified when the device is enumerated. The PnP manager retrieves the requirements for each device during resource allocation. Resources are not dynamically configurable for legacy devices, so the PnP manager assigns resources to legacy devices first.
Loading of appropriate drivers
A programming interface for drivers to interact with the PnP system
The interface includes I/O manager routines, Plug and Play minor IRPs, required standard driver routines, and information in the registry.
Mechanisms for drivers and applications to learn of changes in the hardware environment and take appropriate actions
PnP enables drivers and user-mode code to register for, and be notified of, certain hardware events.
For a driver to qualify as PnP it must provide the required PnP entry points, handle the required PnP IRPs, and follow PnP guidelines.
Plug and play support
This section describes the enumeration process on the Universal Serial Bus.
When a device is plugged in to a Windows-based computer, the Windows USB stack enumerates the device, extracting details from the device including the interface descriptor (or descriptors) of the device, and then generates a set of hardware IDs and compatible IDs for the device.
For a complete list of USB hardware IDs, see the «Device Identification Strings» section under Device Installation.
The examples in the following sections illustrate two scenarios:
- USB IDs for a single interface USB device
- USB IDs for a multi-interface (composite) USB device
Example 1: Single Interface HID USB Device
This example shows how the hardware IDs and compatible IDs are generated for a single-interface USB device on a system running Windows 2000 or Windows XP.
When the device is originally enumerated by the USB stack, the USBHUB driver extracts idVendor, idProduct, and bcdDevice from the device descriptor. These three fields are incorporated to generate a USB hardware ID. Note that the vendor, device, and revision numbers are always stored in hexadecimal format.
The generation of the compatible ID for the device is more complicated. The class code, subclass code, and protocol code are determined by the interface descriptor’s bInterfaceClass, bInterfaceSubClass, and bInterfaceProtocol. These values are in two-digit hexadecimal format.
NoteВ В If you are providing an INF, your hardware identifiers should match the bold identifiers in the left column of the following table. (You should avoid using the compatible identifiers listed in the right column.)
Hardware Identifiers: Compatible Identifiers
USB\Vid_xxxx&Pid_yyyy&Rev_zzzz: USB\Class_aa&SubClass_bb&Prot_cc
USB\Vid_xxxx&Pid_yyyy: USB\Class_aa&SubClass_bb
Example 2: Multiple Interface/Function HID USB Device (Composite Device)
USB devices with multiple functions are called composite devices. This example shows how the hardware IDs and compatible IDs are generated for composite USB devices on Windows. When a new USB composite device is plugged into a computer system running Windows, the USBHUB driver creates a physical device object (PDO) and notifies the operating system that its set of child devices has changed. After querying the hub driver for the hardware IDs associated with the new PDO, the system searches the appropriate INF files to find a match for the identifiers. If a vendor chooses to load just one driver for the entire device (that is, not using the composite device driver) and multiplex all interfaces in software with that driver, the vendor should specify a hardware ID match to prevent the operating system from picking up the lower-ranking match (USB\COMPOSITE).
NoteВ В If you are providing an INF, your hardware identifiers should match the bold identifiers in the left column of the following table. (You should avoid using the compatible identifiers listed in the right column.)
Hardware Identifiers: Compatible Identifiers
USB\Vid_xxxx&Pid_yyyy&Rev_zzzz: USB\Class_aa&SubClass_bb&Prot_cc
USB\Vid_xxxx&Pid_yyyy: USB\Class_aa&SubClass_bb
If, however, no hardware match is found, Windows Plug and Play makes use of the USB\COMPOSITE identifier to load the USB Generic Parent driver (USBCCGP). The Generic Parent driver then creates a separate set of PDOs (one for every interface) with a separate set of hardware IDs for each interface of the composite device. The following section displays the format of hardware IDs for child PDOs.
To build the set of hardware IDs for each interface’s PDO, the USBCCGP driver appends the interface number (which is a zero-based hexadecimal value) to the end of the hardware ID.
The class code, subclass code, and protocol code are determined by the bInterfaceClass, bInterfaceSubClass, and bInterfaceProtocol fields of the interface descriptor, respectively. These values are in two-digit hexadecimal format.
NoteВ В If you are providing an INF, either to load your driver or to provide a friendly device name, your hardware identifiers should match the bold identifiers in the left column of the following table. (You should avoid using the compatible identifiers listed in the right column.)
Hardware Identifiers: Compatible Identifiers
USB\Vid_xxxx&Pid_yyyy&Rev_zzzz&MI_ww: USB\Class_aa&SubClass_bb&Prot_cc
USB\Vid_xxxx&Pid_yyyy&MI_ww: USB\Class_aa&SubClass_bb
Warning: battery is low; plug the computer in.
Replies (4)
Hi Richard. I’m Greg, an installation specialist and 9 year Windows MVP, here to help you.
Check the manufacturer’s Support web page for your full model number to see if there is a battery issue or recall for it.
Then generate a battery report and post it back here: https://www.groovypost.com/howto/generate-batte.
Right click Start to open Device Manager, under Battery choose the battery device, then Driver tab, then if available Roll Back the driver. If not available, choose Uninstall Driver, restart PC to reinstall.
If this was caused by April Version 1803 update can roll back Version 1803 in Settings>Update & Security>Recovery and then hide it until it matures using the Hide Updates Tool downloaded from here: http://download.microsoft.com/download/f/2/2/f2.
If this was caused by Windows Updates then you can check which were installed at Settings>Update & Security>Windows Update under Installed Updates, then uninstall them from the link there, and hide with the Hide Updates tool downloaded from here: http://download.microsoft.com/download/f/2/2/f2.
You can also use System Restore to get before the problem began, then check for Updates with the Hide Update tool and hide them: http://home.bt.com/tech-gadgets/computing/how-t.
If nothing else helps then you might need to replace the battery. However I will tell you that most OEM after-market batteries and chargers have problems so I would only buy the official manufacturer’s battery from the PC maker to be sure.
I hope this helps. Feel free to ask back any questions and let us know how it goes. I will keep working with you until it’s resolved.
Windows MVP 2010-20
Over 100,000 helped in forums in 10 years
I do not quit for those who are polite and cooperative.
I will walk you through any steps and will not let you fail.
4 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Hi Richard, please try this:
Open Device Manager (accessible by right clicking your Start Button)
Expand the Batteries section
For each device in that section:
Right click and choose Disable
Then right click and choose Enable
Close Device Manager
Open the Settings App
Go to Update & Security — Troubleshoot
Run these troubleshooters
Hardware and devices
Power to the Developer!
MSI GV72 — 17.3″, i7-8750H (Hex Core), 32GB DDR4, 4GB GeForce GTX 1050 Ti, 256GB NVMe M2, 2TB HDD
6 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Press Windows key + X
Click Device Manager
Expand Batteries
Right-click Microsoft ACPI-Compliant System.
Choose Update Driver Software.
Make sure you are connected to the Internet, the check for updates.
Check if its working.
Other things you can try.
1. Run Windows 10 Battery Diagnostics
If your battery isn’t fully charging, the first thing you can try is the Battery troubleshooter in Windows 10.
Open Start > Settings > Update & security > Troubleshoot
Scroll down then click Power
Click Run the troubleshooter
Complete the wizard then restart your device to see if the problem is resolved.
Most laptop computers include their own factory diagnostics utilities, too. It is recommended you also use those to test your battery. Accessing the diagnostics will vary by manufacturer, so, consult the documentation that came with your computer. Before you run a test, you might need to first fully charge the device to 99 or 100 percent, disconnect the AC adapter, boot into the diagnostic utility then run the test.
2. Check if Your AC Power Supply is Properly Connected
Sometimes the power cable connected to your AC power supply brick might be loose. Check to make sure it is fitted and secured properly.
3. Try a Different Wall Outlet and Check for Low Voltage and Electrical Issues
The other day, my house had some serious electrical issues going on. You would be amazed how much voltage issues can affect the performance of your system. Plugging in my laptop into an outlet within my room dimmed the light, while an outlet in the living room caused it to wink.
Another room it remained constant but charging was horribly slow. This, of course, meant I had low voltage issues and with so many appliances competing for the little bit of faulty energy, it made it even worse. Ultimately, I ended hiring an electrician to sort out the issues. After fixing it up, my laptop started charging normally.
4. Test with Another Charger
I mentioned the AC power adapter earlier. It’s possible your charger might be the culprit. If you have a working spare laying around the home, give it a try to see if it charges. You can also borrow one from your work colleague if you don’t have any. If you don’t have access to another charger, try yours on another laptop to see if it charges the device.
If you are mixing and matching laptop power adapters, make sure you choose the correct power supply (https://www.amazon.com/s/ref=nb_sb_noss_2?url=s. ). Read the brick and make sure it has the same polarity and voltage as the adapter for your laptop.
5. Remove All External Devices
If you keep external devices such as a smartphone, a USB external drive, mouse, printer and anything else attached to your system while charging, it will take longer for your battery to reach 100%. Make sure you disconnect all of those devices so your system won’t be competing with all the other electronics.
6. Check Your Connectors for Dirt or Damage
If your laptop has a modular battery, remove it then check for any damage or to see if it needs cleaning around the contacts and inside the battery compartment. Also, check if there are any dust particles inside the charging port that might be preventing the battery from charging.
7. Check for BIOS and Chipset Driver Updates
Sometimes your system might be overdue for an update for components such as your BIOS and Chipset. Updates can help resolve bugs that might be preventing the battery from charging efficiently.
8. Press and Release Power Button Reset
Sometimes unknown glitches can prevent the battery from charging. An easy way to fix it is to power down your computer, hold down the power button for 15 to 30 seconds, plug in the AC adapter, then start the computer.
9. Disable Apps and Check Battery Usage in Windows 10
Going back to Windows 10 a bit, recently, I noticed my Surface Pro was taking an unusually long time to charge and the fans started to rev up. Little did I notice the culprit was right there on my Taskbar all along. Slack’s Windows client was waiting in an attempt to connect to the Internet. So, checking your apps to determine whats running in the background can help you not only conserve battery life but limit what prevents it from charging faster.
There are a couple ways to do that. Open Start > Settings > Privacy > Background apps. Scroll down then toggle off the apps that might be preventing your device from reaching a full charge.
Still in Settings, open System > Battery > Battery usage by app. This will tell you which apps are using the most battery and you can make a decision what to do, whether to let Windows decide if it should run in the background while not sacrificing battery life.
10. Replace Charger or Battery Module
Ultimately, if you don’t see any improvements after trying all the above, then it’s maybe best that you replace either the charger or battery itself. This will require contacting your laptop manufacturer and placing an order. Batteries and the chargers are not necessarily cheap, especially if its an older system. But, if you have no choice, its something you will just have to do to get your system back in working order.
Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.