summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-23 10:58:02 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-24 00:32:33 +0000
commit6f4af268099881e5b75520c76ac65223453ce1d5 (patch)
tree943088558ddb766f516341ecc3e2fc0a76bb91c6
parentc1717516549d16f9230d6e1123c647f2d3c7b62e (diff)
downloadchrome-ec-6f4af268099881e5b75520c76ac65223453ce1d5.tar.gz
pd: poll PD events only on Google accessories
Poll USB PD accessories for event log entries only after we have performed a Discover Identity and identified them as a Google device (USB VID = 0x18d1) in order to avoid confusing third party devices with our logging VDM. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:35858 TEST=connect Zinger to Samus and see the proper PD log entries. Change-Id: I022fa0d19dc012e46a27b786a724ff251280eeaf Reviewed-on: https://chromium-review.googlesource.com/242871 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/pd_log.c3
-rw-r--r--common/usb_pd_policy.c9
-rw-r--r--include/usb_pd.h8
3 files changed, 18 insertions, 2 deletions
diff --git a/common/pd_log.c b/common/pd_log.c
index 00757690f2..ca66313b9d 100644
--- a/common/pd_log.c
+++ b/common/pd_log.c
@@ -176,6 +176,9 @@ dequeue_retry:
int i, res;
incoming_logs = 0;
for (i = 0; i < PD_PORT_COUNT; ++i) {
+ /* only accessories who knows Google logging format */
+ if (pd_get_identity_vid(i) != USB_VID_GOOGLE)
+ continue;
res = pd_fetch_acc_log_entry(i);
if (res == EC_RES_BUSY) /* host should retry */
return EC_RES_BUSY;
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index e67f08caa1..ebe6d6e8bc 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -340,6 +340,11 @@ uint32_t pd_dfp_exit_mode(int port)
return 0;
}
+uint16_t pd_get_identity_vid(int port)
+{
+ return PD_IDH_VID(pe[port].identity[0]);
+}
+
#ifdef CONFIG_CMD_USB_PD_PE
static void dump_pe(int port)
{
@@ -356,7 +361,7 @@ static void dump_pe(int port)
idh_ptype = PD_IDH_PTYPE(pe[port].identity[0]);
ccprintf("IDENT:\n");
ccprintf("\t[ID Header] %08x :: %s, VID:%04x\n", pe[port].identity[0],
- idh_ptype_names[idh_ptype], PD_IDH_VID(pe[port].identity[0]));
+ idh_ptype_names[idh_ptype], pd_get_identity_vid(port));
ccprintf("\t[Cert Stat] %08x\n", pe[port].identity[1]);
for (i = 2; i < ARRAY_SIZE(pe[port].identity); i++) {
ccprintf("\t");
@@ -600,7 +605,7 @@ static int hc_remote_pd_discovery(struct host_cmd_handler_args *args)
if (*port >= PD_PORT_COUNT)
return EC_RES_INVALID_PARAM;
- r->vid = PD_IDH_VID(pe[*port].identity[0]);
+ r->vid = pd_get_identity_vid(*port);
r->ptype = PD_IDH_PTYPE(pe[*port].identity[0]);
/* pid only included if vid is assigned */
if (r->vid)
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 2a473bb628..f2358d02b3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -939,6 +939,14 @@ uint32_t pd_dfp_exit_mode(int port);
void pd_dfp_pe_init(int port);
/**
+ * Return the VID of the USB PD accessory connected to a specified port
+ *
+ * @param port USB-C port number
+ * @return the USB Vendor Identifier or 0 if it doesn't exist
+ */
+uint16_t pd_get_identity_vid(int port);
+
+/**
* Store Device ID & RW hash of device
*
* @param port USB-C port number