Allow externalisation of PrintAndLog#506
Conversation
|
This one kind of crosses over the define of ON_DEVICE which also introduces a substitute for printandlog function. I agree with a unified way but this needs remake. Line 30 in c0a2ae5 |
|
OK. Whatever mechanism is ideal, I'd also like something similar for How I'm using this on Android in a "real context" is that I have my version of PrintAndLog: And then that gets brought into an event handler in Java: And then my Activity hooks this event handler: |
|
@iceman1001 From #501:
And regarding last comment:
The referenced commit actually redirects stuff going in to the PrintAndLog function, and then that gets stubbed out "on device". Unfortunately this isn't really appropriate for my purposes as I actually want to send it somewhere else. What you have in
The "easy way" to sort this is for the logging related functions to go live in their own file (eg: What do you think of this? |
|
As long as we have one way of stubbing printandlog function, on device, or on android, simplifying the code, in one place I'm fine. If it needs to go to a seperate file for it to happend, I see no issue with it. it can not be spread over several files, with defines, or execptions, making codesmells and hard to maintain scenarios. iclass commmands uses one, you use one. I looking forward to see a good impl and you can close / create a new PR. |
|
I don't see an issue with this PR. I don't think that the |
|
If you are referring to the define prnt PrintAndLog in lfdemod.c, it is there only to allow that file to be used on arm, where there is no PrintAndLog, and client. Which is a different purpose than this PR. |
|
common/protocols.c |
On Android, we handle stdout and logging a little differently. stdout is also sent to
/dev/null. However, there are a number of global variables declared inui.cwhich are useful for the rest of the application.This adds a define
EXTERNAL_PRINTANDLOGwhich will disable the stockPrintAndLogimplementation in proxmark3. If defined, this would require that an implementer bring their ownPrintAndLogfunction that implements the same API.Example implementation for Android given below, which will push logs into the
INFOlog for the application (accessible via Logcat). A better implementation of this would pull it into the rest of the application's UI.