static inline char mon_text_get_setup(struct mon_event_text *ep, struct urb *urb, char ev_type) { if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') return '-'; if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) return mon_dmapeek(ep->setup, urb->setup_dma, SETUP_MAX); if (urb->setup_packet == NULL) return 'Z'; /* '0' would be not as pretty. */ memcpy(ep->setup, urb->setup_packet, SETUP_MAX); return 0; }
static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, int len, char ev_type) { int pipe = urb->pipe; if (len <= 0) return 'L'; if (len >= DATA_MAX) len = DATA_MAX; /* * Bulk is easy to shortcut reliably. * XXX Other pipe types need consideration. Currently, we overdo it * and collect garbage for them: better more than less. */ if (usb_pipebulk(pipe) || usb_pipecontrol(pipe)) { if (usb_pipein(pipe)) { if (ev_type == 'S') return '<'; } else { if (ev_type == 'C') return '>'; } } /* * The check to see if it's safe to poke at data has an enormous * number of corner cases, but it seems that the following is * more or less safe. * * We do not even try to look transfer_buffer, because it can * contain non-NULL garbage in case the upper level promised to * set DMA for the HCD. */ if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) return mon_dmapeek(ep->data, urb->transfer_dma, len); if (urb->transfer_buffer == NULL) return 'Z'; /* '0' would be not as pretty. */ memcpy(ep->data, urb->transfer_buffer, len); return 0; }
static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, int len, char ev_type, struct mon_bus *mbus) { if (len <= 0) return 'L'; if (len >= DATA_MAX) len = DATA_MAX; if (ep->is_in) { if (ev_type != 'C') return '<'; } else { if (ev_type != 'S') return '>'; } /* * The check to see if it's safe to poke at data has an enormous * number of corner cases, but it seems that the following is * more or less safe. * * We do not even try to look at transfer_buffer, because it can * contain non-NULL garbage in case the upper level promised to * set DMA for the HCD. */ if (urb->dev->bus->uses_dma && (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) { return mon_dmapeek(ep->data, urb->transfer_dma, len); } if (urb->transfer_buffer == NULL) return 'Z'; /* '0' would be not as pretty. */ memcpy(ep->data, urb->transfer_buffer, len); return 0; }