mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
devices: usb: log unknown control transfer types
Improve the log message for unexpected commands received on control endpoints to include the type of command. BUG=chromium:1231779 TEST=./test_all Change-Id: I29963739bf5c5cb9fa427011fe5468a7378b67e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3083225 Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
231a54f36f
commit
a6aeccc679
2 changed files with 22 additions and 4 deletions
|
@ -273,10 +273,10 @@ impl HostDevice {
|
|||
|
||||
fn handle_control_transfer(&mut self, transfer: XhciTransfer) -> Result<()> {
|
||||
let xhci_transfer = Arc::new(transfer);
|
||||
match xhci_transfer
|
||||
let transfer_type = xhci_transfer
|
||||
.get_transfer_type()
|
||||
.map_err(Error::GetXhciTransferType)?
|
||||
{
|
||||
.map_err(Error::GetXhciTransferType)?;
|
||||
match transfer_type {
|
||||
XhciTransferType::SetupStage(setup) => {
|
||||
if self.ctl_ep_state != ControlEndpointState::SetupStage {
|
||||
error!("Control endpoint is in an inconsistant state");
|
||||
|
@ -320,7 +320,10 @@ impl HostDevice {
|
|||
}
|
||||
_ => {
|
||||
// Non control transfer should not be handled in this function.
|
||||
error!("Non control (could be noop) transfer sent to control endpoint.");
|
||||
error!(
|
||||
"Non control {} transfer sent to control endpoint.",
|
||||
transfer_type,
|
||||
);
|
||||
xhci_transfer
|
||||
.on_transfer_complete(&TransferStatus::Completed, 0)
|
||||
.map_err(Error::TransferComplete)?;
|
||||
|
|
|
@ -108,6 +108,21 @@ pub enum XhciTransferType {
|
|||
Noop,
|
||||
}
|
||||
|
||||
impl Display for XhciTransferType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use self::XhciTransferType::*;
|
||||
|
||||
match self {
|
||||
Normal(_) => write!(f, "Normal"),
|
||||
SetupStage(_) => write!(f, "SetupStage"),
|
||||
DataStage(_) => write!(f, "DataStage"),
|
||||
StatusStage => write!(f, "StatusStage"),
|
||||
Isochronous(_) => write!(f, "Isochronous"),
|
||||
Noop => write!(f, "Noop"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl XhciTransferType {
|
||||
/// Analyze transfer descriptor and return transfer type.
|
||||
pub fn new(mem: GuestMemory, td: TransferDescriptor) -> Result<XhciTransferType> {
|
||||
|
|
Loading…
Reference in a new issue