- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
/* IOCTL calls for E-Ink paper update */
#define EPAPER_UPDATE_LOCAL 0x101 /** Update localarea */
#define EPAPER_UPDATE_PART 0x102 /** ??? */
#define EPAPER_UPDATE_FULL 0x103 /** Fully update */
#define EPAPER_UPDATE_DISPLAY_QT 0x120d /** Update all display
/* Helper FB update function */
int epaper_update_helper(int fb, unsigned long int ioctl_call, void *mode)
{
if (framebuffer_descriptor >= 0)
{
errno=0;
ioctl(fb, ioctl_call, mode);
// sleep_timer=sleep_timeout; // Reset sleep timer on every display refresh = we are not have any constantly refreshing display parts now!
return errno;
}
return TRUE;
}
void epaperUpdate(__attribute__((unused)) unsigned long int ioctl_call, __attribute__((unused)) void *mode)
{
#ifndef __amd64
int ioctl_result;
#endif //__amd64
TRACE("Called void epaperUpdate()\n");
if (enable_refresh == FALSE)
{
TRACE("Display refresh was locked, IGNORED!\n");
(void) ioctl_call;
(void) mode;
return;
}
#ifndef __amd64
/* Иначе запись в видеопамять не успевает завершиться и получаем верхний левый угол новой картинки и нижний правый - прежней. */
// if (hw_platform != HW_PLATFORM_SIBRARY_GTK) {
// const struct timespec delay = {0, QT_REFRESH_DELAY};
// nanosleep(&delay, NULL);
// }
ioctl_result=epaper_update_helper(framebuffer_descriptor, ioctl_call, mode);
#ifdef debug
if (ioctl_result != 0)
{
TRACE("Display refresh ioctl call FAILED %d (%s)\n", ioctl_result, strerror(ioctl_result));
// GTK прошивка, обновление от Qt: 1 (Операция не позволяется)
// Qt прошивка, обновление от GTK: 22 (Недопустимый аргумент)
}
#else
(void) ioctl_result;
#endif
#endif
return;
}
int detect_refresh_type (void)
{
int mode=3;
#if 0
struct mxcfb_update_data data = {
.update_region =
{ .top = 0,
.left = 0,
.width = 1,
.height = 1
},
.update_mode = UPDATE_MODE_FULL,
.update_marker = 0,
.waveform_mode = WAVEFORM_MODE_AUTO,
.temp = TEMP_USE_AMBIENT,
.flags = 0
};
#endif
if (epaper_update_helper(framebuffer_descriptor, EPAPER_UPDATE_DISPLAY_QT, &mode) == 0)
{
refresh_type=REFRESH_NEW;
TRACE("Display refresh was successed, new\n");
}
else if (epaper_update_helper(framebuffer_descriptor, EPAPER_UPDATE_FULL, &mode) == 0)
{
refresh_type=REFRESH_LEGACY;
TRACE("Display refresh was successed, legacy\n");
}
// else if (epaper_update_helper(framebuffer_descriptor, MXCFB_SEND_UPDATE_ORG, &data) == 0)
// {
// refresh_type=REFRESH_KOBO;
// TRACE("Display refresh was successed, kobo\n");
// }
else
{
TRACE("Display refresh was not detected!\n");
}
return (refresh_type);
}