AJbotic
AJbotic

Reputation: 85

How to interpret tcl command in openOCD manual

I'm completely new to tcl and am trying to understand how to script the command "adapter usb location" in openOCD.

From the openOCD manual, the command has this description: openOCD manual

I want to point it to the port with the red arrow below: lsusb -t

Thanks.

Upvotes: 2

Views: 639

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137627

It's not 100% clear, but I would expect (from that snippet of documentation) a bus location to be a dotted “path” something like:

1-6

where the values are:

  • 1 — Bus ID
  • 6 — Port ID

Which would result in a call to the command being done like this:

adapter usb location 1-6

When there's a more complex structure involved (internally because of chained hubs) such as with the item above the one you pointed at, I'd instead expect:

1-5.3

Notice that there are is a sequence of port IDs (5.3) in there to represent the structure. The resulting call would then be:

adapter usb location 1-5.3

Now for the caveats!

I can't tell what the actual format of those IDs is. They might just be numbers, or they might have some textual prefix (e.g., bus1-port6). Those text prefixes, if present, might contain a space (or other metacharacter) which will be deeply annoying to use if true. You should be able to run adapter usb location without any other arguments to see what the current location is; be aware though that it might return the empty string (or give an error) if there is no current location. I welcome feedback on this, as that information appears to be not present in any online documentation I can find (and I don't have things installed so I can't just check).

I also have no idea what (if anything) to do with the device and interface IDs.

Upvotes: 2

Related Questions