I tried reimplementing a few PM3 client commands in Lua and in pure Python, and it gets tricky very quickly - as in, you’re looking at reimplementing the entire client essentially. There are several problems with that:
-
The PM3’s protocol is a hodgepodge of high-level commands that get executed by the PM3’s hardware (easy to implement) and low-level raw data reads and writes that are decoded and interpreted client-side (harder)
-
The documentation is beyond sketchy (read: there isn’t one - read the code)
-
It’s a shifting target: it keeps changing from one iteration of the firmware / client to the next, which is why it’s so important to keep the two in sync.
In the end, I decided the bext course of action is to use the client as a backend. Spawn it as a separate process, send it commands through its stdin and get the results back through its stdout. And even that is not ideal: for instance, SiRFIDaL can use the PM3 as a reader, but I’ve had one report telling me it doesn’t work anymore because either one of the commands it issues it has changed, or the client’s output has changed and the regex used to recover the data it needs doesn’t match anymore.
The PM3’s software - firmware and hardware - is a maintainability, interoperability and compatibility nightmare. If it wasn’t a community project that someone kindly does on his own time, I’d be extremely pissed off with it.