koreader/koreader-base

Cervantes 3 model detection is incorrect

frio opened this issue · 2 comments

frio commented

In #745 @pazos implemented support for the bq Cervantes line of devices, with the Cervantes 4 being the test device. I've had some time today to test out my Cervantes 3, and have found that koreader won't start. There's a few separate bugs which I'll describe here; I can resolve one of them but I usually program further up the stack and I'm hitting the limits of my low-level powers.

The first issue is that koreader wouldn't start. I tracked this down to frontend/device/cervantes/device.lua in koreader and will open a PR there -- it appears that there isn't a default/fall-through for unimplemented methods like hasNaturalLight, so I added a no method (the inverse of yes, defined at the top of that file) and managed to get koreader starting.

Unfortunately, the screen never does anything. fbink appears to work, and a bit of digging led me to the following:

11/10/18-09:41:21 DEBUG refresh: partial -1 -1 1074 1450
11/10/18-09:41:21 DEBUG mxc_update: 1072x1448 region @ (0, 0) with marker 43 (WFM: 257 & UPD: 0)
11/10/18-09:41:21 DEBUG MXCFB_SEND_UPDATE ioctl failed: Inappropriate ioctl for device

Google led me to strace and the following:

write(1, " mxc_update: 1072x1448 region @ "..., 73 mxc_update: 1072x1448 region @ (0, 0) with marker 43 (WFM: 257 & UPD: 0)) = 73
write(1, "\n", 1
)                       = 1
ioctl(4, 0x4040462e, 0x2c613458)        = -1 ENOTTY (Inappropriate ioctl for device)

I note that the second argument there, 0x4040462e is the MXCFB_SEND_UPDATE for the Pocketbook. The Cervantes, as per ffi/framebuffer_mxcfb.lua should be 0x4044462e.

So -- it appears that this argument is wrong, but I'm stuck getting much further here. The value in mxcfb_cervantes_h.lua is correct, and I believe that's getting imported in framebuffer_mxcfb.lua (EDIT -- ah, but that's based on some device detection and it checks if it isPocketBook before it gets to the Cervantes -- I'm digging here now).

If anyone can suggest what might've gone wrong, I'd appreciate it! I'm happy to open a PR when we manage to dig the fix up :).

frio commented

Ooh, got it. 0x4040462e is also MXCFB_SEND_UPDATE_OLD for the old Cervantes devices. In ffi/framebuffer_mxcfb.lua we check if the self.device.model is a Cervantes3, but it's actually a Cervantes 3! I'll open a PR :).

pazos commented

@frio: thanks for your feedback!. It is really nice seeing others using KOReader on these devices.

0x4040462e is also MXCFB_SEND_UPDATE_OLD for the old Cervantes devices

I copied this from original device kernel sources but seems unused, so I will remove that and use MXCFB_SEND_UPDATE for all the lineup, just like qt driver does.

check if the self.device.model is a Cervantes3

The check logic is flawed. There is a tiny little room for optimization in newer devices (ie: using REGAL waveforms in partial/ui updates & set the flags accordly). I got good results in my cervantes4 which I think will work on cervantes3, so If you're willing to try, I will push those changes and leave cervantes2013 as an old device until somebody comes in with that device to test.

BTW, regarding your original comment about the switching page bug on developers firmware, this was fixed upstream in bq/cervantes#9 thanks to @avsej