summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-12-12 12:23:07 +0700
committerhathach <[email protected]>2023-12-12 12:23:07 +0700
commitf986f1f22df05f1e930f95c456c0a2a9aeddf5c7 (patch)
tree1c01df8c38f1023ef9936898993da6f31edc678d
parentb5448a7987cc321607f0641ba3922c5b322e3bb4 (diff)
add reset usb bus
-rw-r--r--.github/workflows/build_esp.yml8
-rw-r--r--.github/workflows/cmake_arm.yml8
-rw-r--r--hw/bsp/nrf/family.c10
3 files changed, 23 insertions, 3 deletions
diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml
index fded0e85d..51df644a5 100644
--- a/.github/workflows/build_esp.yml
+++ b/.github/workflows/build_esp.yml
@@ -95,3 +95,11 @@ jobs:
- name: Test on actual hardware
run: |
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
+
+ - name: Reset USB bus
+ run: |
+ for port in $(lspci | grep USB | cut -d' ' -f1); do
+ echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
+ sleep 1;
+ echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
+ done
diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml
index 0df51a3ca..f760ca3ca 100644
--- a/.github/workflows/cmake_arm.yml
+++ b/.github/workflows/cmake_arm.yml
@@ -139,3 +139,11 @@ jobs:
- name: Test on actual hardware
run: |
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
+
+ - name: Reset USB bus
+ run: |
+ for port in $(lspci | grep USB | cut -d' ' -f1); do
+ echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
+ sleep 1;
+ echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
+ done
diff --git a/hw/bsp/nrf/family.c b/hw/bsp/nrf/family.c
index 5b0ddc69f..7a970f52e 100644
--- a/hw/bsp/nrf/family.c
+++ b/hw/bsp/nrf/family.c
@@ -207,11 +207,15 @@ size_t board_get_unique_id(uint8_t id[], size_t max_len) {
(void) max_len;
#ifdef NRF5340_XXAA
- uintptr_t device_id = (uintptr_t) NRF_FICR->INFO.DEVICEID;
+ uintptr_t did_addr = (uintptr_t) NRF_FICR->INFO.DEVICEID;
#else
- uintptr_t device_id = (uintptr_t) NRF_FICR->DEVICEID;
+ uintptr_t did_addr = (uintptr_t) NRF_FICR->DEVICEID;
#endif
- memcpy(id, (void*) device_id, 8);
+
+ const uint8_t* device_id = (const uint8_t*) did_addr;
+ for(uint8_t i=0; i<8; i++) {
+ id[i] = device_id[i];
+ }
return 8;
}