Skip to content

Commit

Permalink
Accomodate OTAG protocol identification on ORBTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Aug 12, 2024
1 parent d9151f7 commit 90413b4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Src/orbtraceIf.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ static const struct OrbtraceInterfaceType _validDevices[DEVICE_NUM_DEVICES] =
{ 0, 0 }
};

#define LAST_NONOTAG_ORBTRACE "v1.3.1-0"
#define SPECIAL_MATCH "v1.3.2-0"

/* BMP iInterface string */
#define BMP_IFACE "Black Magic Trace Capture"

Expand All @@ -49,6 +46,11 @@ static const struct OrbtraceInterfaceType _validDevices[DEVICE_NUM_DEVICES] =
/* Maximum descriptor length from USB specification */
#define MAX_USB_DESC_LEN (256)

/* ORBTrace protocol versions */
#define PROT_UNKNOWN (0x00)
#define PROT_TPIU (0x01)
#define PROT_OTAGV1_0 (0x10)

/* String on front of version number to remove */
#define VERSION_FRONTMATTER "Version: "
static const struct
Expand Down Expand Up @@ -548,7 +550,9 @@ bool OrbtraceGetIfandEP( struct OrbtraceIf *o )
if (
i->bInterfaceClass != 0xff ||
i->bInterfaceSubClass != 0x54 ||
( i->bInterfaceProtocol != 0x00 && i->bInterfaceProtocol != 0x01 ) ||
( i->bInterfaceProtocol != PROT_UNKNOWN &&
i->bInterfaceProtocol != PROT_TPIU &&
i->bInterfaceProtocol != PROT_OTAGV1_0 ) ||
i->bNumEndpoints != 0x01 )
{
/* Not the interface we're looking for */
Expand All @@ -560,6 +564,7 @@ bool OrbtraceGetIfandEP( struct OrbtraceIf *o )

altsetting = i->bAlternateSetting;
num_altsetting = config->interface[if_num].num_altsetting;
o->supportsOTAG = ( i->bInterfaceProtocol == PROT_OTAGV1_0 );

genericsReport( V_DEBUG, "Found interface %#x with altsetting %#x and ep %#x" EOL, o->iface, altsetting, o->ep );
interface_found = true;
Expand All @@ -575,10 +580,6 @@ bool OrbtraceGetIfandEP( struct OrbtraceIf *o )
}

o->isOrbtrace = true;
/* This is ick and will be changed soon */
o->supportsOTAG = ( ( strncmp( LAST_NONOTAG_ORBTRACE, o->devices[o->activeDevice].version, strlen( LAST_NONOTAG_ORBTRACE ) ) < 0 )
&& strncmp ( SPECIAL_MATCH, o->devices[o->activeDevice].version, strlen( SPECIAL_MATCH ) ) );

break;
}

Expand Down

0 comments on commit 90413b4

Please sign in to comment.