class Dread::GadgetEvent

Constants

EVENT_CMD_CMPL
EVENT_CONNECT_DONE
EVENT_DISCONNECT
EVENT_EOPF
EVENT_ERRATIC_ERROR
EVENT_HIBER_REQ
EVENT_L1RESUME
EVENT_L1SUSP
EVENT_OVERFLOW
EVENT_RESET
EVENT_SOF
EVENT_STOPPEDONDISCONNECT
EVENT_VNDRDEVTSTRCVED
EVENT_WAKEUP

Attributes

type[R]

Public Class Methods

new(line) click to toggle source
Calls superclass method
# File lib/dread/gadget_event.rb, line 39
def initialize(line)
  super

  @event_type = {
    EVENT_DISCONNECT => "Disconnect",
    EVENT_RESET => "Reset",
    EVENT_CONNECT_DONE => "Connect Done",
    EVENT_LINK_STATE_CHANGE => "Link State Change",
    EVENT_WAKEUP => "Wakeup",
    EVENT_HIBER_REQ => "Hibernation Request",
    EVENT_EOPF => "End Of Packet Frame",
    EVENT_SOF => "Start Of Frame",
    EVENT_L1SUSP => "L1 Suspend",
    EVENT_ERRATIC_ERROR => "Erratic Error",
    EVENT_CMD_CMPL => "Command Complete",
    EVENT_OVERFLOW => "Overflow",
    EVENT_VNDRDEVTSTRCVED => "Vendor Device Test LMP Received",
    EVENT_STOPPEDONDISCONNECT => "Stopped On Disconnect",
    EVENT_L1RESUME => "L1 Resume / Remote Wake",
  }

  @link_state = {
    LINK_STATE_U0 => "U0",
    LINK_STATE_U1 => "U1",
    LINK_STATE_U2 => "U2",
    LINK_STATE_U3 => "U3",
    LINK_STATE_SS_DIS => "SS.Disconnect",
    LINK_STATE_RX_DET => "Rx.Detect",
    LINK_STATE_SS_INACT => "SS.Inactive",
    LINK_STATE_POLL => "Polling",
    LINK_STATE_RECOV => "Recovery",
    LINK_STATE_HRESET => "Hot Reset",
    LINK_STATE_CMPLY => "Compliance",
    LINK_STATE_LPBK => "Loopback",
    LINK_STATE_RESET => "Reset",
    LINK_STATE_RESUME => "Resume",
  }

  decode
end

Public Instance Methods

decode() click to toggle source
Calls superclass method Dread::Event#decode
# File lib/dread/gadget_event.rb, line 80
def decode
  @event_data = super

  @type = field(@event_data, 11, 8)
  @link = field(@event_data, 19, 16)
end
to_s() click to toggle source
Calls superclass method
# File lib/dread/gadget_event.rb, line 87
def to_s
  super + ": #{@event_type[@type]} [#{@link_state[@link]}]"
end