From 3e985820c15d77e92c95cab4f695042e13d80188 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 14 Jul 2020 13:49:22 +0200 Subject: [PATCH] include Linux logs as text files for completeness. Also fix the location of the files in the text. --- advanced/linux-configured.txt | 42 +++++++++++++++++++ advanced/linux-enumeration.txt | 42 +++++++++++++++++++ .../src/getting-device-configured.md | 5 ++- embedded-workshop-book/src/idle-state.md | 6 +-- 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 advanced/linux-configured.txt create mode 100644 advanced/linux-enumeration.txt diff --git a/advanced/linux-configured.txt b/advanced/linux-configured.txt new file mode 100644 index 0000000..2eaaba3 --- /dev/null +++ b/advanced/linux-configured.txt @@ -0,0 +1,42 @@ +INFO:usb_5 -- USB: UsbReset @ 397.15576ms +INFO:usb_5 -- USB reset condition detected +INFO:usb_5 -- USB: UsbEp0Setup @ 470.00122ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: Device, length: 64 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_5 -- USB: UsbEp0DataDone @ 470.306395ms +INFO:usb_5 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_5 -- USB: UsbReset @ 520.721433ms +INFO:usb_5 -- USB reset condition detected +INFO:usb_5 -- USB: UsbEp0Setup @ 593.292235ms +INFO:usb_5 -- EP0: SetAddress { address: Some(21) } +INFO:usb_5 -- USB: UsbEp0Setup @ 609.954832ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: Device, length: 18 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_5 -- USB: UsbEp0DataDone @ 610.260008ms +INFO:usb_5 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_5 -- USB: UsbEp0Setup @ 610.443113ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +WARN:usb_5 -- EP0IN: stalled +INFO:usb_5 -- USB: UsbEp0Setup @ 610.809325ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +WARN:usb_5 -- EP0IN: stalled +INFO:usb_5 -- USB: UsbEp0Setup @ 611.175535ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +WARN:usb_5 -- EP0IN: stalled +INFO:usb_5 -- USB: UsbEp0Setup @ 611.511228ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 } +INFO:dk::usbd -- EP0IN: start 9B transfer +INFO:usb_5 -- USB: UsbEp0DataDone @ 611.846922ms +INFO:usb_5 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_5 -- USB: UsbEp0Setup @ 612.030027ms +INFO:usb_5 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_5 -- USB: UsbEp0DataDone @ 612.365721ms +INFO:usb_5 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_5 -- USB: UsbEp0Setup @ 612.640378ms +INFO:usb_5 -- EP0: SetConfiguration { value: Some(42) } +INFO:usb_5 -- entering the configured state diff --git a/advanced/linux-enumeration.txt b/advanced/linux-enumeration.txt new file mode 100644 index 0000000..89c900c --- /dev/null +++ b/advanced/linux-enumeration.txt @@ -0,0 +1,42 @@ +INFO:usb_4 -- USB: UsbReset @ 318.66455ms +INFO:usb_4 -- USB reset condition detected +INFO:usb_4 -- USB: UsbEp0Setup @ 391.418456ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: Device, length: 64 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_4 -- USB: UsbEp0DataDone @ 391.723632ms +INFO:usb_4 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_4 -- USB: UsbReset @ 442.016601ms +INFO:usb_4 -- USB reset condition detected +INFO:usb_4 -- USB: UsbEp0Setup @ 514.709471ms +INFO:usb_4 -- EP0: SetAddress { address: Some(17) } +INFO:usb_4 -- USB: UsbEp0Setup @ 531.37207ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: Device, length: 18 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_4 -- USB: UsbEp0DataDone @ 531.646727ms +INFO:usb_4 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_4 -- USB: UsbEp0Setup @ 531.829832ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint +INFO:usb_4 -- USB: UsbEp0Setup @ 532.226562ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint +INFO:usb_4 -- USB: UsbEp0Setup @ 532.592772ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 } +ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint +INFO:usb_4 -- USB: UsbEp0Setup @ 533.020018ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 } +INFO:dk::usbd -- EP0IN: start 9B transfer +INFO:usb_4 -- USB: UsbEp0DataDone @ 533.386228ms +INFO:usb_4 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_4 -- USB: UsbEp0Setup @ 533.569335ms +INFO:usb_4 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 } +INFO:dk::usbd -- EP0IN: start 18B transfer +INFO:usb_4 -- USB: UsbEp0DataDone @ 533.935546ms +INFO:usb_4 -- EP0IN: transfer complete +INFO:dk::usbd -- EP0IN: transfer done +INFO:usb_4 -- USB: UsbEp0Setup @ 534.118651ms +INFO:usb_4 -- EP0: SetConfiguration { value: Some(42) } +ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint diff --git a/embedded-workshop-book/src/getting-device-configured.md b/embedded-workshop-book/src/getting-device-configured.md index f981aa4..f93ac56 100644 --- a/embedded-workshop-book/src/getting-device-configured.md +++ b/embedded-workshop-book/src/getting-device-configured.md @@ -37,7 +37,7 @@ To handle a SET_CONFIGURATION, do the following: - if `wValue` is non-zero and valid (was previously reported in a configuration descriptor) then move to the `Configured` state with the new configuration value - if `wValue` is not valid then stall the endpoint -In all the cases where you did not stall the endpoint (by returning `Err`) you'll need to acknowledge the request by starting a STATUS stage. +In all the cases where you did not stall the endpoint (by returning `Err`) you'll need to acknowledge the request by starting a STATUS stage. This is done by writing 1 to the TASKS_EP0STATUS register. NOTE: On Windows, you may get a `GET_STATUS` request *before* the `SET_CONFIGURATION` request and although you *should* respond to it, stalling the `GET_STATUS` request seems sufficient to get the device to the `Configured` state. @@ -91,8 +91,9 @@ INFO:usb_5 -- EP0: SetConfiguration { value: Some(42) } INFO:usb_5 -- entering the configured state ``` -These logs are from a Linux host. You can find traces for other OSes in these files (they are next to this README): +These logs are from a Linux host. You can find traces for other OSes in these files (they are in the `advanced` folder): +- `linux-configured.txt` (same logs as the ones shown above) - `win-configured.txt`, this file only contains the logs produced by running `print-descs` - `macos-configured.txt` diff --git a/embedded-workshop-book/src/idle-state.md b/embedded-workshop-book/src/idle-state.md index 9852617..7286bab 100644 --- a/embedded-workshop-book/src/idle-state.md +++ b/embedded-workshop-book/src/idle-state.md @@ -49,10 +49,11 @@ ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint Note that these logs are from a Linux host where a `SET_CONFIGURATION` request is sent after the `SET_ADDRESS` request. On other OSes you may not get that request before the bus goes idle. Also note that there are some `GET_DESCRIPTOR DeviceQualifier` requests in this case; you do not need to parse them in the `usb` crate as they'll be rejected (stalled) anyways. -You can find traces for other OSes in these files (they are next to this README): +You can find traces for other OSes in these files (they are in the `advanced` folder): -- `win-enumeration.txt` +- `linux-enumeration.txt` (same logs as the ones shown above) - `macos-enumeration.txt` +- `win-enumeration.txt` At this point you can double check that the enumeration works by running the [`usb-list` tool](#listing-usb-devices) while `usb-4.rs` is running. @@ -65,4 +66,3 @@ Bus 001 Device 016: ID 2020:0717 <- nRF52840 on the nRF52840 Development Kit Both the J-Link and the nRF52840 should appear in the list. You can find a working solution up to this point in `src/bin/usb-4-solution.rs`. Note that the solution uses the `usb2` crate to parse SETUP packets and that crate supports parsing all standard requests. -