Skip to content

Commit

Permalink
Merge pull request #35 from h7x4/fixup-serde-impls
Browse files Browse the repository at this point in the history
Fixup serde impls
  • Loading branch information
jiegec authored Oct 30, 2023
2 parents 4316e61 + d890684 commit f9246c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit f9246c0

Please sign in to comment.