2 ** Main lightpen driver calibration functions.
\r
4 ** 2013-06-23, Greg King
\r
13 static const char *name;
\r
16 /* Get a lightpen calibration value from a file if it exists. Otherwise, call
\r
17 ** pen_calibrate() to create a value; then, write it into a file, so that it
\r
18 ** will be available at the next time that the lightpen is used.
\r
19 ** Might change the screen.
\r
21 static void __fastcall__ adjuster (unsigned char *XOffset)
\r
23 int fd = open (name, O_RDONLY);
\r
26 pen_calibrate (XOffset);
\r
27 fd = open (name, O_WRONLY | O_CREAT | O_EXCL);
\r
29 (void) write (fd, XOffset, 1);
\r
33 (void) read (fd, XOffset, 1);
\r
39 /* pen_adjust() is optional; if you want to use its feature,
\r
40 ** then it must be called before a driver is installed.
\r
41 ** Note: This function merely saves the file-name pointer, and sets
\r
42 ** the mouse_adjuster pointer. The file will be read only when a driver
\r
43 ** is installed, and only if that driver wants to be calibrated.
\r
45 void __fastcall__ pen_adjust (const char *filename)
\r
47 if (filename != NULL && filename[0] != '\0') {
\r
49 mouse_adjuster = adjuster;
\r
51 mouse_adjuster = pen_calibrate;
\r