OK, I've got ttyDB0 mostly working. I've managed to figure out the control codes, but there still seem to be problems:
Occassionally, the response time is very good, but most of the time it's more than a second! WHY?!?!?!
Also, after my program exists, all the keys that I've entered get sent again to the regular Reader UI. Why?!?
Lastly, it turns out that everything else DOES stop working when I poll ttyDB0 incessantly. This includes the power button! Also, the power button doesn't have a key code associated with it (it must be another type of message).
Code:
key codes (gathered by trial and error):
#define KEY_1 0x72
#define KEY_2 0x43
#define KEY_3 0x73
#define KEY_4 0x44
#define KEY_5 0x74
#define KEY_6 0x45
#define KEY_7 0x75
#define KEY_8 0x46
#define KEY_9 0x76
#define KEY_0 0x47
#define KEY_CRCL_RIGHT 0x30
#define KEY_CRCL_LEFT 0x31
#define KEY_PG_RIGHT 0x70
#define KEY_PG_LEFT 0x71
#define KEY_VOL_UP 0x40
#define KEY_VOL_DOWN 0x41
#define KEY_DOWN 0x23
#define KEY_RIGHT 0x24
#define KEY_LEFT 0x25
#define KEY_UP 0x26
#define KEY_MENU 0x21
#define KEY_MARK 0x32
#define KEY_SIZE 0x42
eink commands (gathered from the driver):
0xA0 -- mark beginning of sending of screen data to the Eink controller's memory. I don't know if this starts sending per se or rather prevents multiple display calls from overlapping or does something else.
0xA1 -- mark end of sending screen data
0xAA -- get status -- used after sending to check transfer
0xA2 -- render the screen -- display the data that is in the Eink controller's framebuffer
0xA3 -- erase display -- makes the screen white. useful after changing depth.
0x01
0xA4 -- eink init -- (1) used when initting the driver.
0x01
0xA5 -- restore pic -- display the previous image sent to the controller (ie, if you execute SEND_NEWPIC, you can undo it)
0xB0 -- begin sending partial screen data to the Eink controller. After this command, send the rectangle info.
0xB1 -- render the screen. The driver uses this in conjuction with 0xB0 althought oxA2 also works. Seems to be the same performance, so I don't know the real point.
0xF0 -- go to 'normal' power management state (the state during ioctl calls)
0xF1 -- go to 'sleep' power management state (the state between ioctl calls)
0xF2 -- go to standby power management state (the state while the Reader is "off")
0xF3 -- set depth
0x00 2-bit
0x02 4-bit
0xF5 -- rotate.
0x01 "rotate 90 degrees"
0xF7 -- positivepic -- black-on-white mode.
0xF8 -- negativepic -- white-on-black mode. (doesn't seem to have anything to do with page-turn flashing)
0xFC -- refresh screen. is sometimes a substitute for display_pic. causes a flash.
0xF9 -- autorefresh on (doesn't seem to work)
0xFA -- autorefresh off (see above)
0xFB -- set refresh time (used with autorefresh)
0x64 -- "10 minutes"
0xFD -- get refresh time (used with autorefresh)
0xE0 "get_verocont" (0) NO IDEA what this does
0xE2 "get display status" (1) same
0x10 -- write register
0x"set supply delay"
0x11 -- write register
0x01 -- some sort of access of "flash." used by "clear flash", "write flash," also the "LUT." no idea what this means.
0x02 -- same
0x21 -- get eink temperature
0xEE "eink reset"