Removing global context around pm3 connectivity (work in progress)#346
Removing global context around pm3 connectivity (work in progress)#346micolous wants to merge 4 commits intoProxmark:masterfrom
Conversation
|
Impressive, btw, sidenote |
This removes many global variables from the client. This would allow:
And yes, this pretty much stashes everything that looks like a global variable into that connection struct. Some things like the command buffer I want to pull out of there and stash it somewhere else, but this is the simplest interface without significantly rewriting the pm3 client.
I'll put that on the TODO list, but as that code is sitting in |
|
Thanks for the answers, would you mind telling more about destroy and create the pm3_connection struct and how it will enable restarting connection without restarting binary. I'm very curious about this part for obvious reasons :) The debug is twofolded, on clientside its mostly used for LF code. the g_debuglevel has nothing todo on the deviceside. The deviceside has more then one.. Since you are upto changing it, what would your suggestion be for that? A unified debug level on both client/device side or two seperate ones? |
|
Besides getting rid of global state and encapsulating communication in a separate module, you have also added the long overdue recv_lock. 👍 Re |
|
Please don't try to put everything in one PR. You are risking that it will never be accepted because no one can thoroughly test it. You could start with putting all comm functions in comms.c and comms.h but still have global comms state. Then deglobalize comms struct. Then the debugging. |
|
Re: I still need to shuffle it in the Regarding destroying and creating the I'll see what I can do about getting the comms code changes separated (though it may still be paired with flasher code changes because they really should be updated together). |
|
Closing this out as I'm not working on this particular branch further, and it would require changing nearly every single source file in PM3. |
This is related to cleanup work in #334. This includes PR #341, so should wait until that is merged. It is quite large, and not finished or tested as much as I'd like yet, but will give you an early preview.
It:
pm3_connectionstructure.comms.cmodule.Caveats:
pm3_connectionstructure inside Lua's global state, and then all the methods just read off that.pm3_connectionstruct for lack of a better place.save_restore{DB,GB}have a "global" stash which all connections can access.TODO:
CMD_DOWNLOADED_RAW_ADC_SAMPLES_125Kand the mechanisms around it need improvement -- it is possible to use it overwrite arbitrary memory within the memory space of the client. I'm still working out a good way to handle this without breaking too much stuff, because as far as I can tell, it's intended as a one way DMA.