--- a/drivers/usb/ucsid/src/main.rs +++ b/drivers/usb/ucsid/src/main.rs @@ -785,7 +785,11 @@ .context("failed to read I2C control response")?; buffer.truncate(count); let text = std::str::from_utf8(&buffer).context("I2C control response was not UTF-8")?; - ron::from_str(text).context("failed to decode I2C control response") + let trimmed = text.trim(); + if trimmed.is_empty() { + return Ok(I2cControlResponse::AdapterList(Vec::new())); + } + ron::from_str(trimmed).context("failed to decode I2C control response") } fn read_symbol_id(path: &Path) -> Result> { --- a/drivers/gpio/i2c-gpio-expanderd/src/main.rs +++ b/drivers/gpio/i2c-gpio-expanderd/src/main.rs @@ -429,7 +429,11 @@ .context("failed to read I2C control response")?; buffer.truncate(count); let text = std::str::from_utf8(&buffer).context("I2C control response was not UTF-8")?; - ron::from_str(text).context("failed to decode I2C control response") + let trimmed = text.trim(); + if trimmed.is_empty() { + return Ok(I2cControlResponse::AdapterList(Vec::new())); + } + ron::from_str(trimmed).context("failed to decode I2C control response") } fn eisa_id_from_integer(integer: u64) -> String {