{"id":13544495,"url":"https://github.com/rust-embedded-community/usbd-serial","last_synced_at":"2025-12-12T16:51:27.336Z","repository":{"id":41866473,"uuid":"188258465","full_name":"rust-embedded-community/usbd-serial","owner":"rust-embedded-community","description":"Work-in progress minimal CDC-ACM (USB serial port) class for usb-device","archived":false,"fork":false,"pushed_at":"2025-10-07T11:42:13.000Z","size":56,"stargazers_count":129,"open_issues_count":10,"forks_count":46,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-25T20:11:04.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"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/rust-embedded-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-23T15:14:29.000Z","updated_at":"2025-10-07T11:42:18.000Z","dependencies_parsed_at":"2024-01-16T17:02:46.746Z","dependency_job_id":"9ae206b3-e7ba-4fd2-92f0-0d69b70e4e9b","html_url":"https://github.com/rust-embedded-community/usbd-serial","commit_stats":{"total_commits":28,"total_committers":7,"mean_commits":4.0,"dds":0.3928571428571429,"last_synced_commit":"a986c83bafbca0b65fe5afa448f1d70b0cf4a4e0"},"previous_names":["mvirkkunen/usbd-serial"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rust-embedded-community/usbd-serial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded-community%2Fusbd-serial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded-community%2Fusbd-serial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded-community%2Fusbd-serial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded-community%2Fusbd-serial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-embedded-community","download_url":"https://codeload.github.com/rust-embedded-community/usbd-serial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded-community%2Fusbd-serial/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27686529,"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","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-01T11:00:50.167Z","updated_at":"2025-12-12T16:51:27.329Z","avatar_url":"https://github.com/rust-embedded-community.png","language":"Rust","funding_links":[],"categories":["Support crates for USB Host and USB Device Support"],"sub_categories":["Work in progress"],"readme":"usbd-serial\n===========\n\nCDC-ACM USB serial port implementation for [usb-device](https://crates.io/crates/usb-device).\n\nCDC-ACM is a USB class that's supported out of the box by most operating systems and used for\nimplementing modems and generic serial ports. The SerialPort class implements a stream-like buffered\nserial port that can be used similarly to a normal UART.\n\nThe crate also contains CdcAcmClass which is a lower-level implementation that has less overhead,\nbut requires more care to use correctly.\n\nExample\n=======\n\nA full example requires the use of a hardware-driver, but the hardware independent part is as\nfollows:\n\n```rust\nlet mut serial = SerialPort::new(\u0026usb_bus);\n\nlet mut usb_dev = UsbDeviceBuilder::new(\u0026usb_bus, UsbVidPid(0x16c0, 0x27dd))\n    .strings(\u0026[StringDescriptors::new(LangID::EN).product(\"Serial port\")])\n    .expect(\"Failed to set strings\")\n    .device_class(USB_CLASS_CDC)\n    .build();\n\nloop {\n    if !usb_dev.poll(\u0026mut [\u0026mut serial]) {\n        continue;\n    }\n\n    let mut buf = [0u8; 64];\n\n    match serial.read(\u0026mut buf[..]) {\n        Ok(count) =\u003e {\n            // count bytes were read to \u0026buf[..count]\n        },\n        Err(UsbError::WouldBlock) =\u003e // No data received\n        Err(err) =\u003e // An error occurred\n    };\n\n    match serial.write(\u0026[0x3a, 0x29]) {\n        Ok(count) =\u003e {\n            // count bytes were written\n        },\n        Err(UsbError::WouldBlock) =\u003e // No data could be written (buffers full)\n        Err(err) =\u003e // An error occurred\n    };\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded-community%2Fusbd-serial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-embedded-community%2Fusbd-serial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded-community%2Fusbd-serial/lists"}