diff options
author | Anton Staaf <robotboy@chromium.org> | 2014-10-28 11:27:24 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-29 18:37:53 +0000 |
commit | 450b882dee25ed1f5035531f898a9e75748e72c1 (patch) | |
tree | 4a8e56997a9f2b9eab39d75ec4b21db66aae5e4e | |
parent | 4626fd37dfe05e45593bf717b71d1b99df70d75e (diff) | |
download | chrome-ec-450b882dee25ed1f5035531f898a9e75748e72c1.tar.gz |
USB-console: Add string names for console interfaces
These names can be used to uniquely identify an interface
as being a console forwarded from the AP, or the EC's
console or some other console. This makes it possible to
connect to the correct console from servo without knowing
what board is attached. These strings could also be used
by udev rules to create appropriate symlinks.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Change-Id: I1abd36f952782a03606b09485917be8e154534ce
Reviewed-on: https://chromium-review.googlesource.com/225950
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
-rw-r--r-- | board/discovery-stm32f072/board.c | 9 | ||||
-rw-r--r-- | board/discovery-stm32f072/board.h | 1 | ||||
-rw-r--r-- | board/discovery-stm32f072/echo.c | 1 | ||||
-rw-r--r-- | board/twinkie/board.c | 1 | ||||
-rw-r--r-- | board/twinkie/board.h | 1 | ||||
-rw-r--r-- | chip/stm32/usb-stream.h | 3 | ||||
-rw-r--r-- | chip/stm32/usb_console.c | 2 |
7 files changed, 12 insertions, 6 deletions
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c index b5637612aa..f6eea229b8 100644 --- a/board/discovery-stm32f072/board.c +++ b/board/discovery-stm32f072/board.c @@ -42,10 +42,11 @@ USB_GPIO_CONFIG(usb_gpio, USB_EP_GPIO) const void *const usb_strings[] = { - [USB_STR_DESC] = usb_string_desc, - [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), - [USB_STR_PRODUCT] = USB_STRING_DESC("discovery-stm32f072"), - [USB_STR_VERSION] = NULL /* filled at runtime */, + [USB_STR_DESC] = usb_string_desc, + [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), + [USB_STR_PRODUCT] = USB_STRING_DESC("discovery-stm32f072"), + [USB_STR_VERSION] = NULL /* filled at runtime */, + [USB_STR_STREAM_NAME] = USB_STRING_DESC("Echo"), }; BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); diff --git a/board/discovery-stm32f072/board.h b/board/discovery-stm32f072/board.h index bb3fdee002..531a52e9b9 100644 --- a/board/discovery-stm32f072/board.h +++ b/board/discovery-stm32f072/board.h @@ -75,6 +75,7 @@ enum usb_strings { USB_STR_VENDOR, USB_STR_PRODUCT, USB_STR_VERSION, + USB_STR_STREAM_NAME, USB_STR_COUNT }; diff --git a/board/discovery-stm32f072/echo.c b/board/discovery-stm32f072/echo.c index 8fa6435458..f8396ba3a6 100644 --- a/board/discovery-stm32f072/echo.c +++ b/board/discovery-stm32f072/echo.c @@ -33,6 +33,7 @@ USART_CONFIG(usart3, usart3_hw, 115200, 64, 64, in_ready, NULL) USART_CONFIG(usart4, usart4_hw, 115200, 64, 64, in_ready, NULL) USB_STREAM_CONFIG(usb_stream1, USB_IFACE_STREAM, + USB_STR_STREAM_NAME, USB_EP_STREAM, 256, 256, diff --git a/board/twinkie/board.c b/board/twinkie/board.c index 682c15945e..bfd7e078b9 100644 --- a/board/twinkie/board.c +++ b/board/twinkie/board.c @@ -76,5 +76,6 @@ const void * const usb_strings[] = { [USB_STR_PRODUCT] = USB_STRING_DESC("Twinkie"), [USB_STR_VERSION] = NULL /* filled at runtime */, [USB_STR_SNIFFER] = USB_STRING_DESC("USB-PD Sniffer"), + [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"), }; BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); diff --git a/board/twinkie/board.h b/board/twinkie/board.h index df1ca2ec7f..edfcc4800b 100644 --- a/board/twinkie/board.h +++ b/board/twinkie/board.h @@ -74,6 +74,7 @@ enum usb_strings { USB_STR_PRODUCT, USB_STR_VERSION, USB_STR_SNIFFER, + USB_STR_CONSOLE_NAME, USB_STR_COUNT }; diff --git a/chip/stm32/usb-stream.h b/chip/stm32/usb-stream.h index 92cfc4e60d..796eacaa17 100644 --- a/chip/stm32/usb-stream.h +++ b/chip/stm32/usb-stream.h @@ -105,6 +105,7 @@ extern struct out_stream_ops const usb_stream_out_stream_ops; */ #define USB_STREAM_CONFIG(NAME, \ INTERFACE, \ + INTERFACE_NAME, \ ENDPOINT, \ RX_SIZE, \ TX_SIZE, \ @@ -153,7 +154,7 @@ extern struct out_stream_ops const usb_stream_out_stream_ops; .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ .bInterfaceSubClass = USB_SUBCLASS_GOOGLE_SERIAL, \ .bInterfaceProtocol = USB_PROTOCOL_GOOGLE_SERIAL, \ - .iInterface = 0, \ + .iInterface = INTERFACE_NAME, \ }; \ const struct usb_endpoint_descriptor \ USB_EP_DESC(INTERFACE, 0) = { \ diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c index 81121dfcc7..a4a25315fc 100644 --- a/chip/stm32/usb_console.c +++ b/chip/stm32/usb_console.c @@ -39,7 +39,7 @@ const struct usb_interface_descriptor USB_IFACE_DESC(USB_IFACE_CONSOLE) = { .bInterfaceClass = USB_CLASS_VENDOR_SPEC, .bInterfaceSubClass = USB_SUBCLASS_GOOGLE_SERIAL, .bInterfaceProtocol = USB_PROTOCOL_GOOGLE_SERIAL, - .iInterface = 0, + .iInterface = USB_STR_CONSOLE_NAME, }; const struct usb_endpoint_descriptor USB_EP_DESC(USB_IFACE_CONSOLE, 0) = { .bLength = USB_DT_ENDPOINT_SIZE, |