offa / plug

Software for Fender Mustang Amps.
GNU General Public License v3.0
54 stars 20 forks source link

First steps towards support for Mustang/Rumble LT series amps #28

Closed tim-littlefair closed 1 month ago

tim-littlefair commented 1 month ago

Last year I ran some FenderTone sessions in a VM on my laptop with my Mustang LT40S amp, and captured the USB traffic.

I've finally got round to bringing my forked copy of offa-plug up to date and attempting to apply knowledge from the captures to adding support for the LT40S (and presumably other Mustang/Rumble amps in that series) to it.

This is an early pull request so that anyone who is working with similar goals can see the progress I've made so far - it doesn't achieve any meaningful integration with the offa-plug GUI yet, but running a debug build it is possible to see on the console that I've managed to replicate the first three frames sent to the amp by Fender Tone, and I'm receiving similar looking responses to all three.

The first two frames get single packet responses which are just a echo back of the command sent out with a 0x00 byte prepended and the last byte (always 0x00) dropped. The response to the third packet is more interesting, it consists of 24 frames, and I suspect from earlier hacking on the FenderTone capture data that it will contain a large single-line JSON text object when I've worked out the right amount of header to strip from each response packet.

Please find attached a JSON export of capture file, and a log of the debug output from a debug build of my baseline for this PR, when run with the command line option --enable-v3usb-devices. The first command I have replicated occurs at line 4631 in the capture. Searching for the string '"usbhid.data": "35' in the capture will find all 127 commands sent, the response packets all start with '"usbhid.data": "00' and there are many more of them.

It's up to @offa whether to integrate pick this up soon, or watch and see if I get any further with it before bringing it in, or whether just to say its not of interest and leave it out. I'm getting it out there now as I think this might be interesting to some other people looking at offa-plug, particularly some of the people who commented on https://github.com/offa/plug/issues/7. If @offa does want to integrate now or soon he is welcome to keep or discard some of the extra files in this PR which do things like open up the udev rules for developer convenience without requiring plugdev group membership and kdevelop project files, and also to get rid of my horrible wordy comments about different amps in the ConnectionFactory.cpp file.

I'll carry on, see whether I get any further, but no promises...

fendertone-synced.json

output-lt40s-7e25b0e.txt

(If anyone is interested in the raw pcapng capture file, or captures from other ooperations like changing the selected preset please message me directly, or if @offa wants to host them in his tree I'm happy to contribute them).

tim-littlefair commented 1 month ago

I can see the failing checks, will try to work through these over the next week or so.

offa commented 1 month ago

It would be great to reverse the protocol used and finally integrate it into plug.

Do I understand this correctly and those devices uses JSON for data transmission?

The project is quite tailored to Mustang-like devices, but maybe we can get support for other devices too. Still quite some work on both sides, but great to see the first steps.

tim-littlefair commented 1 month ago

It would be great to reverse the protocol used and finally integrate it into plug.

Do I understand this correctly and those devices uses JSON for data transmission?

The project is quite tailored to Mustang-like devices, but maybe we can get support for other devices too. Still quite some work on both sides, but great to see the first steps.

I've done some more work in a new branch. Some way from being ready to do a PR yet, but with the following commit: https://github.com/tim-littlefair/plug/commit/0517f2d50ef7e7afcdad48f3e37b3bad2d4be7bf I was able to export the JSON in the attached file: response1.json

Note that the attached file has been parsed and re-serialized with linefeeds and indentation - the actual JSON packaged in the protocol is single line tightly compacted and hard to read.

tim-littlefair commented 1 month ago

It's now clear to me that this PR contains far to much change in one hit for me to expect @offa to accept it, so I am going to withdraw the request and close it. Hopefully within a week or two I'll be able to put in the time to bring in a PR with some leel of useful support for the LT40S at least with less change to the main app.

tim-littlefair commented 1 month ago

I'll delete the branch on my fork once I've made something more useful visible, but for now I'll leave it there for reference.