Ok, turns out messing with all that javascript was a waste of time. The way that software works is just flawed from bottom up. I was trying to hook how data is being processed to be able to process all packets generated by my modification in external hardware. Apparently it's not possible to process _all_ the packets without hooking the serial port itself. But then, what's the point of using node.js? Bash will do the job.