---
name: "NetPacket::USBMon"
section: "3pm"
platform: "linux"
package: "libnetpacket-perl"
version: "1.7.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/NetPacket::USBMon"
---

# NetPacket::USBMon(3pm)

Assemble and disassemble USB packets captured via Linux USBMon interface.

## NAME

NetPacket::USBMon - Assemble and disassemble USB packets captured via Linux USBMon interface.

## VERSION

version 1.7.2

## SYNOPSIS

```
  use NetPacket::USBMon;
  $usb = NetPacket::USBMon->decode($raw_pkt);
```

## DESCRIPTION

`"NetPacket::USBMon"` is a NetPacket decoder of USB packets captured via Linux USBMon interface.

### Methods

- "NetPacket::USBMon-\>decode(\[RAW PACKET\])"

  Decode a USB packet.

### Instance data

The instance data for the `"NetPacket::UDP"` object consists of the following fields.

- id

  An in-kernel address of the USB Request Block (URB). Stays the same for the transaction submission and completion.

  Might be truncatted when reading a 64-bit capture with 32-bit file.

- type

  URB type. Character 'S', 'C' or 'E', for constants USB\_TYPE\_SUBMISSION, USB\_TYPE\_CALLBACK or USB\_TYPE\_ERROR.

- xfer\_type

  Transfer type. USB\_XFER\_TYPE\_ISO, USB\_XFER\_TYPE\_INTR, USB\_XFER\_TYPE\_CONTROL or USB\_XFER\_TYPE\_BULK.

- ep

  Endpoint identification.

  - num

    Endpoint number.

  - dir

    Transfer direction. "IN" or "OUT".

- devnum

  Device address.

- busnum

  Bus number.

- flag\_setup

  Indicates whether setup is present and makes sense.

- flag\_data

  Indicates whether data is present and makes sense.

- ts\_sec

  Timestamp seconds since epoch. Subject to truncation with 32-bit Perl, which should be fine until 2038.

- ts\_usec

  Timestamp microseconds.

- status

  URB status. Negative errno.

- length

  Length of data (submitted or actual).

- len\_cap

  Delivered length

- setup

  Only present for packets with setup\_flag turned on. Some contents are dependent on actual request type.

  - bmRequestType

    - bRequest

    - wValue

    - wIndex

    - wLength

    - iso

  Only present for isochronous transfers.

  - error\_count

    - numdesc

    - interval

  Isochronous packet response rate.

- start\_frame

  Only applicable to isochronous transfers.

- xfer\_flags

  A copy of URB's transfer\_flags.

- ndesc

  Actual number of isochronous descriptors.

- data

  Packet payload.

### Exports

- default

  none

- exportable

  USB\_TYPE\_SUBMISSION, USB\_TYPE\_CALLBACK, USB\_TYPE\_ERROR, USB\_XFER\_TYPE\_ISO, USB\_XFER\_TYPE\_INTR, USB\_XFER\_TYPE\_CONTROL, USB\_XFER\_TYPE\_BULK, USB\_FLAG\_SETUP\_IRRELEVANT, USB\_FLAG\_SETUP\_RELEVANT, USB\_FLAG\_DATA\_ERROR, USB\_FLAG\_DATA\_INCOMING, USB\_FLAG\_DATA\_OUTGOING, USB\_FLAG\_DATA\_PRESENT, USB\_TYPE\_VENDOR

- tags

  The following tags group together related exportable items.

  - ":types"

    USB\_TYPE\_SUBMISSION, USB\_TYPE\_CALLBACK, USB\_TYPE\_ERROR

  - ":xfer\_types"

    USB\_XFER\_TYPE\_ISO, USB\_XFER\_TYPE\_INTR, USB\_XFER\_TYPE\_CONTROL, USB\_XFER\_TYPE\_BULK

  - ":setup\_flags"

    USB\_FLAG\_SETUP\_IRRELEVANT, USB\_FLAG\_SETUP\_RELEVANT

  - ":data\_flags"

    USB\_FLAG\_DATA\_ERROR, USB\_FLAG\_DATA\_INCOMING, USB\_FLAG\_DATA\_OUTGOING, USB\_FLAG\_DATA\_PRESENT

  - ":setup\_types"

    USB\_TYPE\_VENDOR

  - ":ALL"

    All the above exportable items.

## COPYRIGHT

Copyright (c) 2013 Lubomir Rintel.

This module is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

## AUTHOR

Lubomir Rintel \<lkundrak@v3.sk\>
