Skip to content
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

Fixup serde impls #35

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/setup.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

/// Parse the SETUP packet of control transfers
#[derive(Clone, Copy, Debug, Default)]
Expand Down
6 changes: 6 additions & 0 deletions src/usbip_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use crate::UsbDevice;

/// USB/IP protocol version
Expand Down Expand Up @@ -40,6 +43,7 @@ pub const USBIP_RET_UNLINK: u16 = 0x0004;
/// All commands/responses which rely on a device being attached
/// to a client use this header.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct UsbIpHeaderBasic {
pub command: u32,
pub seqnum: u32,
Expand Down Expand Up @@ -97,6 +101,7 @@ impl UsbIpHeaderBasic {

/// Client side commands from the Virtual Host Controller
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum UsbIpCommand {
OpReqDevlist {
status: u32,
Expand Down Expand Up @@ -272,6 +277,7 @@ impl UsbIpCommand {

/// Server side responses from the USB Host
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub enum UsbIpResponse {
OpRepDevlist {
status: u32,
Expand Down
Loading