-
Notifications
You must be signed in to change notification settings - Fork 47
type-c-service: Implement hard reset flow #729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,6 +244,22 @@ where | |
| .get_power_device(local_port_id) | ||
| .ok_or(Error::Pd(PdError::InvalidPort))?; | ||
| trace!("Port{} status events: {:#?}", global_port_id.0, status_event); | ||
|
|
||
| if status_event.pd_hard_reset() { | ||
| info!("Port{}: PD hard reset", global_port_id.0); | ||
| if let Ok(connected_consumer) = power.try_device_action::<action::ConnectedConsumer>().await { | ||
| info!("Port{}: Disabling sink path due to PD hard reset", global_port_id.0); | ||
| controller.enable_sink_path(local_port_id, false).await?; | ||
| if connected_consumer.disconnect().await.is_err() { | ||
| error!( | ||
| "Port{}: Error disconnecting from ConnectedConsumer after PD hard reset", | ||
| global_port_id.0 | ||
| ); | ||
| return PdError::Failed.into(); | ||
| } | ||
| } | ||
|
Comment on lines
+248
to
+260
|
||
| } | ||
|
|
||
| if status_event.plug_inserted_or_removed() { | ||
| self.process_plug_event(controller, power, local_port_id, &status) | ||
| .await?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disconnect error is logged without the underlying error value (
disconnect().await.is_err()), which makes diagnosing hard-reset issues difficult. Capture theErr(e)and includeein the log (and keep thePdError::Failedreturn if you still want to fail the whole event processing).