Saturday, October 3, 2015

Usb hardware detection for m$

Untested: use at your own risk.

What is new with Serial in Windows 10

The Serial Communication protocol is everywhere; it is broadly available, easy to learn, and low cost.   It is used across many different transports: typically over USB, in cases over Bluetooth and even over TCP/IP.   Many people are familiar with COM ports and programs that read data from and/or write data to them.  Today we find Serial Communications in both 30 year old hardware like natural gas meters and new products like many 3D Printers or those in the prototyping stage based upon Arduino boards.  

We listened to customer feedback on Serial while planning Windows 10 and acted upon two high level points:
  1. Improve Serial over USB driver support from Windows.
  2. Provide a Windows Runtime API for communication with Serial devices.
This blog entry focuses on enhancements for USB connected Serial devices in Windows 10, and how customers can provide additional feedback on them which we can efficiently act upon.
1.   Improved Serial over USB driver support in Windows 10
Earlier versions of Windows contained a driver for USB connected serial devices: usbser.sys. However the driver did not include a compatible ID match in an INF. The driver had to be included using modem INFs which was not standard.
In Windows 10, we added inbox support for USB CDC Abstract Control Model (ACM) compliant hardware. Usbser.sys is now installed as a compatible ID match for USB CDC compliant hardware, without requiring a 3rd party driver or inclusion via modem INFs.
Now devices that report these compatible IDs:
  • USB\Class_02&SubClass_02&Prot_01
  • USB\Class_02&SubClass_02
… including popular prototyping boards like Arduinos – just work with our built-in driver.  

Also usbser.sys has been completely re-written in WDF, improving its overall reliability as well incorporating new features for power management i.e. USB Selective Suspend.  See USB Serial driver on MSDN for details.
2.   A Windows Runtime API for communication with Serial devices
Windows 10 includes the Windows.Devices.SerialCommunication universal API designed for these three scenarios:
  1. USB Peripherals like Arduinos – including as a USB Accessory on new Phones and Tablets
  2. Peripherally connected USB to RS-232 Adapters
  3. UARTs inside embedded  systems like MinnowBoard Max or Raspberry Pi v2 running Windows IoT SKU
This API does not include support for accessing UARTs/COM ports inside Phones/Tablets/PCs; Windows 10 focused on above 3 scenarios.

//Build/ 2015 USB Accessories including SerialCommunications session introduces this API and walks thru the design and usage of it.

Windows 10 SDK includes two Universal SDK samples illustrating this API:
  1. CustomSerialDeviceAccess SDK Sample
  2. New SerialArduino SDK Sample from above //build talk is now available including C# and Arduino sketch source code.
How to Provide Feedback

We listen and act upon customer feedback; all of above are all results of prior feedback.   If you have encountered a problem with functionality described in this blog entry, or want additional functionality, please see below.
Our team listens to two feedback channels to provide feedback:  Forums and the Feedback App (see Feedback App post for additional information) are available to everyone.   Please follow below guidance on where to provide your feedback and what to include to help us efficiently act upon your feedback.
Forums
Please create a new post on the Windows Insider Program forum under the ‘Devices and Drivers’ Topic.
Feedback App
Please file a bug under:
Category:  Hardware, Devices, and Drivers
Sub-Category:  USB devices and connectivity
What information to include
To help us efficiently act upon any bugs for feedback you have, please include relevant information below.
Problems with built-in USBSer.sys
USBSerial driver for USB CDC compliant devices

  • Feedback or Bugs:  Please include ‘USBSer’ in bug title
  • Bugs, please add: 
    • Crisp steps to reproduce the issue
    • Hardware IDs and Compatible IDs for target device  (below)
    • If problem involves data transfer, please include Traces as described under Tracing below.
Problems with Windows.Devices.SerialCommunication Universal API
  • Feedback or Bugs: Please include ‘Windows.Devices.SerialCommunication’ in bug title
  • Bugs, please add:
    • a sample code fragment that illustrates the problem
    • All App manifest device capabilities declarations,  like
 <DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
 <DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
How to capture Hardware IDs
  1. Attach your Arduino, open Device Manager, select the board, select Properties, then Details tab
  2. Select Hardware IDs from Property dropdown
  3. Select the values, right click and “copy” them – and paste into the bug.
  4. Select Compatible IDs from Property dropdown
  5. Select the values, right click and “copy” them – and paste into the bug.
Example: Arduino Uno R3
Hardware IDsUSB\VID_2341&PID_0043&REV_0001USB\VID_2341&PID_0043
Compatible IDsUSB\Class_02&SubClass_02&Prot_01USB\Class_02&SubClass_02USB\Class_02
Tracing
Please enter the copy and paste below commands into an Administrative command window, reproduce the problem, and attach the resultant trace files into a bug:
Before Repro
logman create trace -n Serial_WPP -o %SystemRoot%\Tracing\Serial_WPP.etl -nb 128 640 -bs 128
logman update trace -n Serial_WPP -p {7F82DC23-235A-4CCA-868C-59531F258662} 0x7FFFFFFF 0xFF
logman update trace -n Serial_WPP -p {8FBF685A-DCE5-44C2-B126-5E90176993A7} 0x7FFFFFFF 0xFF
logman update trace -n Serial_WPP -p {0ae46f43-b144-4056-9195-470054009d6c} 0x7FFFFFFF 0xFF
logman start -n Serial_WPP
<Reproduce the problem at this point (do not copy and paste this)>
AfterRepro
logman stop -n Serial_WPP
logman delete -n Serial_WPP
md %systemroot%\Tracing\Logs
move /Y %SystemRoot%\Tracing\Serial_WPP_000001.etl %SystemRoot%\Tracing\Logs\Serial_WPP.etl

No comments:

Post a Comment