Author Topic: uber simple program to send/receive usb frames to any device?  (Read 4541 times)

0 Members and 1 Guest are viewing this topic.

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3910
  • Country: it
uber simple program to send/receive usb frames to any device?
« on: January 09, 2024, 10:48:20 am »
Does anybody know of such a thing?
Whenever i start a new project the first baby steps in communication as done by sending some data and looking at the response if it matches the expected output. This is before i start writing the pc software for it.
For example, if it's using a com port i just open realterm and push some keys. For canbus i open canking or busmaster and send a frame. for BLE i use some app in which i select the service/characterisic and read/write accordingly
Is there a simillar thing for USB?
could also be useful for debugging of an unknown peripheral

ideally i select the devide (VID/PID) and read/write to any available endpoint
i could probably write one of course.. but every time i say nah, let's just start with the application
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: uber simple program to send/receive usb frames to any device?
« Reply #1 on: January 10, 2024, 01:50:20 pm »
Which OS?

In Linux, it'd be simple to write one using the "usbfs" interface (/dev/bus/usb/bbb/ddd); see here.

Personally, I tend to just configure one USB endpoint (pair) as USB Serial, though, which behaves like a pair of unidirectional pipes, and use bash (printf built-in and <> redirection) and stty to set the device to raw mode.
 
The following users thanked this post: DiTBho

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5083
  • Country: gb
Re: uber simple program to send/receive usb frames to any device?
« Reply #2 on: January 10, 2024, 03:18:06 pm »
The real problem is when you have to *snif* a USB device that uses mixed USB-methods[]={ hid-only, bulk, isochronous, ...}.

I'm trying to reverse engineering a damn video capture USB-v2 "hi-speed" device, and it sends different packets on different endpoints with different methods, mainly bulk but also isochronous ... making the data-logging for late analysis a bloody hell.

Worse still, the USB-device only works with Windows, so ... you need a Windows USB-sniffer to log, and late a Linux machine to reproduce commands and sets  :-//
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17774
  • Country: fr
Re: uber simple program to send/receive usb frames to any device?
« Reply #3 on: January 10, 2024, 09:53:46 pm »
Yes reverse-engineering can be tough.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5083
  • Country: gb
Re: uber simple program to send/receive usb frames to any device?
« Reply #4 on: January 11, 2024, 08:38:37 am »
That's why a Windows program that send/receive/sniff USB frames will be usefull to me, too  ;D
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3910
  • Country: it
Re: uber simple program to send/receive usb frames to any device?
« Reply #5 on: January 12, 2024, 06:31:06 am »
Windows! I had no doubts that in linux (and possibly OSX - though i wouldn't be surprised if it was cumbersome for "security reasons") it's something that can already be done from the command line

For sniffing: I think that you can make wireshark work with USB frames? i never managed to make it work under windows though but there are already programs that do it

Unfortunately, i already started wirting the actual application for this board so another wasted opportunity for me to develop such a software  ;D

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf