diff options
Diffstat (limited to 'board/elm/usb_pd_policy.c')
-rw-r--r-- | board/elm/usb_pd_policy.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c index 05cfe97e0b..b03d52e71e 100644 --- a/board/elm/usb_pd_policy.c +++ b/board/elm/usb_pd_policy.c @@ -168,7 +168,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -187,6 +187,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), |