summaryrefslogtreecommitdiff
path: root/board/sentry/usb_pd_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/sentry/usb_pd_policy.c')
-rw-r--r--board/sentry/usb_pd_policy.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/board/sentry/usb_pd_policy.c b/board/sentry/usb_pd_policy.c
index 737c5ba1f5..115796fbe0 100644
--- a/board/sentry/usb_pd_policy.c
+++ b/board/sentry/usb_pd_policy.c
@@ -178,7 +178,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)
@@ -197,6 +197,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),