You might find this useful as a starting point. It's old - apparently last updated in 2014. I have not read through the whole thread and I have not tried running this on my PW2 myself. The first post says that it was made and tested specifically on a PW2, but I don't know whether or not it works on newer firmware versions.
If this thing still works, it seems to be exactly what you're trying to achieve. If it no longer works, perhaps you could update it and share your work for others who are looking for something similar?
https://www.mobileread.com/forums/sho...d.php?t=236104