{"id":19244339,"url":"https://github.com/nanoframework/system.device.usbclient","last_synced_at":"2026-05-28T03:02:54.430Z","repository":{"id":72129248,"uuid":"545129767","full_name":"nanoframework/System.Device.UsbClient","owner":"nanoframework","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-13T00:31:45.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-29T21:06:18.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoframework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"nanoframework","github":"nanoframework"}},"created_at":"2022-10-03T20:47:03.000Z","updated_at":"2024-08-13T00:31:47.000Z","dependencies_parsed_at":"2023-12-18T22:24:38.298Z","dependency_job_id":"c96b8130-8874-4d33-8f6d-746f8a48f7f5","html_url":"https://github.com/nanoframework/System.Device.UsbClient","commit_stats":{"total_commits":66,"total_committers":4,"mean_commits":16.5,"dds":0.4242424242424242,"last_synced_commit":"311a8ce65281a6d4fa09848a0271e522b87495cc"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FSystem.Device.UsbClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FSystem.Device.UsbClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FSystem.Device.UsbClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FSystem.Device.UsbClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoframework","download_url":"https://codeload.github.com/nanoframework/System.Device.UsbClient/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305945,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T17:23:01.644Z","updated_at":"2026-04-17T02:08:31.382Z","avatar_url":"https://github.com/nanoframework.png","language":"C#","funding_links":["https://opencollective.com/nanoframework","https://github.com/sponsors/nanoframework"],"categories":[],"sub_categories":[],"readme":"[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_System.Device.UsbClient\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_System.Device.UsbClient) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_System.Device.UsbClient\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_System.Device.UsbClient) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.UsbStream.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.UsbStream/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord\u0026logoColor=white\u0026label=Discord\u0026color=7289DA)](https://discord.gg/gCyBu8T)\n\n![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png)\n\n-----\n\n# Welcome to the .NET **nanoFramework** USB Client repository\n\n## Build status\n\n| Component | Build Status | NuGet Package |\n|:-|---|---|\n| System.Device.UsbStream | [![Build Status](https://dev.azure.com/nanoframework/System.Device.UsbClient/_apis/build/status/System.Device.UsbClient?branchName=main)](https://dev.azure.com/nanoframework/System.Device.UsbClient/_build/latest?definitionId=99\u0026branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Device.UsbStream.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.UsbStream/) |\n\n## Usage\n\n### USB Stream\n\n`UsbStream` class provides a seamless interface to a stream that can read from and write to an USB Device that's enumerated as a WinUSB device.\nThis allows shipping your .NET nanoFramework device as an USB device without the need for any INF file or specific driver instalation.\n\n#### Creating an UsbStream\n\nCreating an `UsbStream` requries 2 parameters: a `Guid` that will be used as the Device Interface ID and a `string` which will be used as the device description for the USB device.\n\n```csharp\nprivate static Guid deviceInterfaceId = new Guid(\"9e48651c-fa68-4b39-8731-1ee84659aac5\");\nprivate static string deviceDescription = \"nanoDevice\";\n\n// create USB Stream\nvar usbStream = UsbClient.CreateUsbStream(deviceInterfaceId, deviceDescription);\n```\n\n#### Writing to the `UsbStream`\n\nTo write to the `UsbStream` just call the `Write()` method just like any other .NET stream. Like this:\n\n```csharp\n// buffer with dummy data \nvar bufer = new byte[] { 1, 2, 3 };\n\nusbStream.Write(bufer, 0, bufer.Length);\n```\n\n## Debug hints\n\nUSB can be hard. Be prepared for that!\nThere are a number of issues that are prone to cause frustration. Follows some (hopefully valuable) advice.\n\n* If you need to debug device enumeration issues and check what's being passed from the devices, install a tool such as [USB Device Tree Viewer](https://www.uwe-sieber.de/usbtreeview_e.html) from Uwe Sieber. With it you can peruse into every bit of detail about USB device, their interfaces, end points, strings, etc.\n\n* Another great tool is [USBDeview](https://www.nirsoft.net/utils/usb_devices_view.html) from NirSoft. This tool lists all USB devices that currently connected to your computer, as well as all USB devices that you previously used. Extended information is displayed for each USB device. It's possible to uninstall/disable and enable USB devices from the tool.\n\n* Windows caches enumeration of USB devices. What's the problem with that? During development, if the enumeration fails at some point, the device most likely will be marked as being enumerated and on the next connection Windows won't do it again. This can cause the enumeration data to be wrong or incomplete. To fix this and truly force the enumeration to happen from scratch, make sure that:\n\n   1. Delete the device from the Device Manager.\n  \n   1. Delete the entry from the enumeration cache in Registry. This lives at `HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\usbflags\\vvvvpppprrrr`\n\n       Where `vvvv` is the vendor id, `pppp` is the PID and `rrrr` is the device release number.\n\n## Feedback and documentation\n\nFor documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).\n\nJoin our Discord community [here](https://discord.gg/gCyBu8T).\n\n## Credits\n\nThe list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md).\n\n## License\n\nThe **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md).\n\n## Code of Conduct\n\nThis project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community.\nFor more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).\n\n## .NET Foundation\n\nThis project is supported by the [.NET Foundation](https://dotnetfoundation.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fsystem.device.usbclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoframework%2Fsystem.device.usbclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fsystem.device.usbclient/lists"}