Skip to content

Commit

Permalink
tuh_get_hub_addr_port()
Browse files Browse the repository at this point in the history
  • Loading branch information
jfedor2 committed Nov 23, 2023
1 parent cc1f1fe commit 8a307a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ uint16_t tuh_get_ep0_size(uint8_t dev_addr) {
return (dev ? dev->ep0_size : 8); // unknown device probably means we're enumerating
}

bool tuh_get_hub_addr_port(uint8_t dev_addr, uint8_t* hub_addr, uint8_t* hub_port) {
usbh_device_t const *dev = get_device(dev_addr);
TU_VERIFY(dev);

*hub_addr = dev->hub_addr;
*hub_port = dev->hub_port;

return true;
}

//--------------------------------------------------------------------+
// PUBLIC API (Parameter Verification is required)
//--------------------------------------------------------------------+
Expand Down
2 changes: 2 additions & 0 deletions src/host/usbh.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ bool tuh_ready(uint8_t daddr) {

uint16_t tuh_get_ep0_size(uint8_t daddr);

bool tuh_get_hub_addr_port(uint8_t daddr, uint8_t* hub_addr, uint8_t* hub_port);

//--------------------------------------------------------------------+
// Transfer API
//--------------------------------------------------------------------+
Expand Down

0 comments on commit 8a307a4

Please sign in to comment.