Thu Mar 11 12:08:57 2021 UTC ()
ErrorF() doesn't append newlines at the end of messages.


(tsutsui)
diff -r1.7 -r1.8 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c
diff -r1.9 -r1.10 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c
diff -r1.9 -r1.10 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c
diff -r1.10 -r1.11 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c
diff -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c

cvs diff -r1.7 -r1.8 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c (expand / switch to unified diff)

--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c 2020/11/04 17:16:13 1.7
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c 2021/03/11 12:08:57 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x68kFb.c,v 1.7 2020/11/04 17:16:13 tsutsui Exp $ */ 1/* $NetBSD: x68kFb.c,v 1.8 2021/03/11 12:08:57 tsutsui Exp $ */
2/*------------------------------------------------------------------------- 2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki 3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -40,41 +40,41 @@ static int cons_dwidth; @@ -40,41 +40,41 @@ static int cons_dwidth;
40 * configured in X68kConfig. 40 * configured in X68kConfig.
41 * argument: (X68kScreenRec *)pPriv : X68k private screen record 41 * argument: (X68kScreenRec *)pPriv : X68k private screen record
42 * (const char *)device : name of frame buffer device 42 * (const char *)device : name of frame buffer device
43 * returns: (Bool): TRUE if succeeded 43 * returns: (Bool): TRUE if succeeded
44 * FALSE otherwise 44 * FALSE otherwise
45 *-----------------------------------------------------------------------*/ 45 *-----------------------------------------------------------------------*/
46Bool 46Bool
47x68kFbCommonOpen(X68kScreenRec *pPriv, const char *device) 47x68kFbCommonOpen(X68kScreenRec *pPriv, const char *device)
48{ 48{
49 struct grfinfo gi; 49 struct grfinfo gi;
50 50
51 /* open frame buffer */ 51 /* open frame buffer */
52 if ( ( pPriv->fd = open(device, O_RDWR, 0)) < 0) { 52 if ( ( pPriv->fd = open(device, O_RDWR, 0)) < 0) {
53 ErrorF( "Can't open frame buffer" ); 53 ErrorF( "Can't open frame buffer\n" );
54 return FALSE; 54 return FALSE;
55 } 55 }
56 /* get frame buffer infomation */ 56 /* get frame buffer infomation */
57 if ( ioctl( pPriv->fd, GRFIOCGINFO, &gi ) == -1 ) { 57 if ( ioctl( pPriv->fd, GRFIOCGINFO, &gi ) == -1 ) {
58 ErrorF( "Can't get grfinfo" ); 58 ErrorF( "Can't get grfinfo\n" );
59 return FALSE; 59 return FALSE;
60 } 60 }
61 pPriv->mapsize = gi.gd_regsize + gi.gd_fbsize; 61 pPriv->mapsize = gi.gd_regsize + gi.gd_fbsize;
62 62
63 /* map control registers and frame buffer */ 63 /* map control registers and frame buffer */
64 pPriv->reg = (FbReg *)mmap(0, pPriv->mapsize, PROT_READ | PROT_WRITE, 64 pPriv->reg = (FbReg *)mmap(0, pPriv->mapsize, PROT_READ | PROT_WRITE,
65 MAP_FILE | MAP_SHARED, pPriv->fd, 0 ); 65 MAP_FILE | MAP_SHARED, pPriv->fd, 0 );
66 if ( pPriv->reg == (FbReg *)-1) { 66 if ( pPriv->reg == (FbReg *)-1) {
67 ErrorF( "Can't map frame buffer" ); 67 ErrorF( "Can't map frame buffer\n" );
68 return FALSE; 68 return FALSE;
69 } 69 }
70 pPriv->fb = (uint8_t *)((uint32_t)pPriv->reg + gi.gd_regsize); 70 pPriv->fb = (uint8_t *)((uint32_t)pPriv->reg + gi.gd_regsize);
71 71
72 x68kRegSetup( pPriv ); 72 x68kRegSetup( pPriv );
73 cons_dwidth = gi.gd_dwidth; 73 cons_dwidth = gi.gd_dwidth;
74 74
75 return TRUE; 75 return TRUE;
76} 76}
77 77
78/*------------------------------------------------------------------------- 78/*-------------------------------------------------------------------------
79 * function "x68kFbCommonClose" 79 * function "x68kFbCommonClose"
80 * 80 *
@@ -104,27 +104,27 @@ x68kFbCommonClose(X68kScreenRec *pPriv) @@ -104,27 +104,27 @@ x68kFbCommonClose(X68kScreenRec *pPriv)
104 27, 0, 0, 0, 104 27, 0, 0, 0,
105 0, 0, 0, 0, 105 0, 0, 0, 0,
106 0, 0, 0, 0, 106 0, 0, 0, 0,
107 0x0417, 0, 0, 0, 0 }, 107 0x0417, 0, 0, 0, 0 },
108 { 0x0004, 0x21e4, 0x0020 }, 108 { 0x0004, 0x21e4, 0x0020 },
109 0 109 0
110 }; 110 };
111 /* change video mode */ 111 /* change video mode */
112 pPriv->x68kreg = (cons_dwidth == 640) ? graphNone_mode19 : graphNone_mode16; 112 pPriv->x68kreg = (cons_dwidth == 640) ? graphNone_mode19 : graphNone_mode16;
113 x68kRegSetup(pPriv); 113 x68kRegSetup(pPriv);
114 114
115 /* unmap and close frame buffer */ 115 /* unmap and close frame buffer */
116 if ( munmap(pPriv->reg, pPriv->mapsize) == -1 ) 116 if ( munmap(pPriv->reg, pPriv->mapsize) == -1 )
117 ErrorF("Can't unmap frame buffer"); 117 ErrorF("Can't unmap frame buffer\n");
118 close(pPriv->fd); 118 close(pPriv->fd);
119} 119}
120 120
121/*------------------------------------------------------------------------- 121/*-------------------------------------------------------------------------
122 * function "x68kRegSetup" 122 * function "x68kRegSetup"
123 * 123 *
124 * purpose: set up CRT controller and Video controller 124 * purpose: set up CRT controller and Video controller
125 * with register values in pPriv->x68kreg 125 * with register values in pPriv->x68kreg
126 * argument: (X68kScreenRec *)pPriv : X68k private screen record 126 * argument: (X68kScreenRec *)pPriv : X68k private screen record
127 * returns: nothing 127 * returns: nothing
128 *-----------------------------------------------------------------------*/ 128 *-----------------------------------------------------------------------*/
129#define CRTCSET(r) pPriv->reg->crtc.r = pPriv->x68kreg.crtc.r 129#define CRTCSET(r) pPriv->reg->crtc.r = pPriv->x68kreg.crtc.r
130#define VIDEOCSET(r) pPriv->reg->videoc.r = pPriv->x68kreg.videoc.r 130#define VIDEOCSET(r) pPriv->reg->videoc.r = pPriv->x68kreg.videoc.r

cvs diff -r1.9 -r1.10 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c (expand / switch to unified diff)

--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c 2020/11/04 17:16:13 1.9
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c 2021/03/11 12:08:57 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x68kGraph.c,v 1.9 2020/11/04 17:16:13 tsutsui Exp $ */ 1/* $NetBSD: x68kGraph.c,v 1.10 2021/03/11 12:08:57 tsutsui Exp $ */
2/*------------------------------------------------------------------------- 2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki 3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -185,27 +185,27 @@ x68kGraphClose(X68kScreenRec *pPriv) @@ -185,27 +185,27 @@ x68kGraphClose(X68kScreenRec *pPriv)
185 * returns: (Bool) : TRUE if succeeded 185 * returns: (Bool) : TRUE if succeeded
186 * FALSE otherwise 186 * FALSE otherwise
187 *-----------------------------------------------------------------------*/ 187 *-----------------------------------------------------------------------*/
188Bool 188Bool
189x68kGraphInit(ScreenPtr pScreen, int argc, char *argv[]) 189x68kGraphInit(ScreenPtr pScreen, int argc, char *argv[])
190{ 190{
191 X68kScreenRec *pPriv; 191 X68kScreenRec *pPriv;
192 192
193 /* get private screen record set by X68KConfig */ 193 /* get private screen record set by X68KConfig */
194 pPriv = x68kGetScreenRecByType(X68K_FB_GRAPHIC); 194 pPriv = x68kGetScreenRecByType(X68K_FB_GRAPHIC);
195 195
196 /* store private record into screen */ 196 /* store private record into screen */
197 if (!dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) { 197 if (!dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) {
198 ErrorF("dixRegisterPrivateKey failed"); 198 ErrorF("dixRegisterPrivateKey failed\n");
199 return FALSE; 199 return FALSE;
200 } 200 }
201 x68kSetScreenPrivate(pScreen, pPriv); 201 x68kSetScreenPrivate(pScreen, pPriv);
202 202
203 /* register normal cfb screen functions */ 203 /* register normal cfb screen functions */
204 if (!fbSetupScreen(pScreen, pPriv->fb, 204 if (!fbSetupScreen(pScreen, pPriv->fb,
205 pPriv->scr_width, pPriv->scr_height, 205 pPriv->scr_width, pPriv->scr_height,
206 pPriv->dpi, pPriv->dpi, pPriv->fb_width, 206 pPriv->dpi, pPriv->dpi, pPriv->fb_width,
207 pPriv->depth)) 207 pPriv->depth))
208 return FALSE; 208 return FALSE;
209 209
210 /* register colormap functions */ 210 /* register colormap functions */
211 pScreen->InstallColormap = x68kInstallColormap; 211 pScreen->InstallColormap = x68kInstallColormap;

cvs diff -r1.9 -r1.10 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c (expand / switch to unified diff)

--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c 2021/02/07 16:55:18 1.9
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c 2021/03/11 12:08:57 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x68kMouse.c,v 1.9 2021/02/07 16:55:18 tsutsui Exp $ */ 1/* $NetBSD: x68kMouse.c,v 1.10 2021/03/11 12:08:57 tsutsui Exp $ */
2/*------------------------------------------------------------------------- 2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki 3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -126,27 +126,27 @@ x68kMouseProc(DeviceIntPtr device, int w @@ -126,27 +126,27 @@ x68kMouseProc(DeviceIntPtr device, int w
126 int format; 126 int format;
127 static int oformat; 127 static int oformat;
128 BYTE map[4]; 128 BYTE map[4];
129 Atom btn_labels[3] = {0}; 129 Atom btn_labels[3] = {0};
130 Atom axes_labels[2] = { 0, 0 }; 130 Atom axes_labels[2] = { 0, 0 };
131 MouseEmu3btnPtr pEmu3btn; 131 MouseEmu3btnPtr pEmu3btn;
132 Bool emu3enable; 132 Bool emu3enable;
133 int emu3timeout; 133 int emu3timeout;
134 134
135 switch (what) { 135 switch (what) {
136 case DEVICE_INIT: 136 case DEVICE_INIT:
137 pMouse->devicePrivate = (void *) &x68kMousePriv; 137 pMouse->devicePrivate = (void *) &x68kMousePriv;
138 if( (x68kMousePriv.fd = open("/dev/mouse", O_RDONLY)) == -1 ) { 138 if( (x68kMousePriv.fd = open("/dev/mouse", O_RDONLY)) == -1 ) {
139 ErrorF("Can't open mouse device"); 139 ErrorF("Can't open mouse device\n");
140 return !Success; 140 return !Success;
141 } 141 }
142 pMouse->on = FALSE; 142 pMouse->on = FALSE;
143 map[1] = 1; 143 map[1] = 1;
144 map[2] = 2; 144 map[2] = 2;
145 map[3] = 3; 145 map[3] = 3;
146 btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); 146 btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
147 btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); 147 btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
148 btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); 148 btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
149 axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); 149 axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
150 axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); 150 axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
151 151
152 InitPointerDeviceStruct(pMouse, map, 3, btn_labels, 152 InitPointerDeviceStruct(pMouse, map, 3, btn_labels,
@@ -155,54 +155,54 @@ x68kMouseProc(DeviceIntPtr device, int w @@ -155,54 +155,54 @@ x68kMouseProc(DeviceIntPtr device, int w
155 155
156 /* Initialize emulation 3 buttons settings */ 156 /* Initialize emulation 3 buttons settings */
157 emu3enable = TRUE; /* XXX should be configurable */ 157 emu3enable = TRUE; /* XXX should be configurable */
158 emu3timeout = EMU3B_DEF_TIMEOUT; /* XXX should be configurable */ 158 emu3timeout = EMU3B_DEF_TIMEOUT; /* XXX should be configurable */
159 if (emu3enable) { 159 if (emu3enable) {
160 pEmu3btn = &x68kMousePriv.emu3btn; 160 pEmu3btn = &x68kMousePriv.emu3btn;
161 Emulate3ButtonsEnable(pEmu3btn, device, emu3timeout); 161 Emulate3ButtonsEnable(pEmu3btn, device, emu3timeout);
162 } 162 }
163 163
164 break; 164 break;
165 165
166 case DEVICE_ON: 166 case DEVICE_ON:
167 if (ioctl (x68kMousePriv.fd, VUIDGFORMAT, &oformat) == -1) { 167 if (ioctl (x68kMousePriv.fd, VUIDGFORMAT, &oformat) == -1) {
168 ErrorF("x68kMouseProc ioctl VUIDGFORMAT"); 168 ErrorF("x68kMouseProc ioctl VUIDGFORMAT\n");
169 return !Success; 169 return !Success;
170 } 170 }
171 format = VUID_FIRM_EVENT; 171 format = VUID_FIRM_EVENT;
172 if (ioctl (x68kMousePriv.fd, VUIDSFORMAT, &format) == -1) { 172 if (ioctl (x68kMousePriv.fd, VUIDSFORMAT, &format) == -1) {
173 ErrorF("x68kMouseProc ioctl VUIDSFORMAT"); 173 ErrorF("x68kMouseProc ioctl VUIDSFORMAT\n");
174 return !Success; 174 return !Success;
175 } 175 }
176 if ( fcntl(x68kMousePriv.fd, F_SETOWN, getpid()) == -1 || 176 if ( fcntl(x68kMousePriv.fd, F_SETOWN, getpid()) == -1 ||
177 fcntl(x68kMousePriv.fd, F_SETFL, O_NONBLOCK | O_ASYNC) == -1 177 fcntl(x68kMousePriv.fd, F_SETFL, O_NONBLOCK | O_ASYNC) == -1
178 ) { 178 ) {
179 ErrorF("Async mouse I/O failed"); 179 ErrorF("Async mouse I/O failed\n");
180 return !Success; 180 return !Success;
181 } 181 }
182 x68kMousePriv.bmask = 0; 182 x68kMousePriv.bmask = 0;
183 SetNotifyFd(x68kMousePriv.fd, x68kMouseHandlerNotify, 183 SetNotifyFd(x68kMousePriv.fd, x68kMouseHandlerNotify,
184 X_NOTIFY_READ, NULL); 184 X_NOTIFY_READ, NULL);
185 pMouse->on = TRUE; 185 pMouse->on = TRUE;
186 break; 186 break;
187 187
188 case DEVICE_OFF: 188 case DEVICE_OFF:
189 pMouse->on = FALSE; 189 pMouse->on = FALSE;
190 RemoveNotifyFd(x68kMousePriv.fd); 190 RemoveNotifyFd(x68kMousePriv.fd);
191 break; 191 break;
192 192
193 case DEVICE_CLOSE: 193 case DEVICE_CLOSE:
194 if (ioctl (x68kMousePriv.fd, VUIDSFORMAT, &oformat) == -1) 194 if (ioctl (x68kMousePriv.fd, VUIDSFORMAT, &oformat) == -1)
195 ErrorF("x68kMouseProc ioctl VUIDSFORMAT"); 195 ErrorF("x68kMouseProc ioctl VUIDSFORMAT\n");
196 break; 196 break;
197 197
198 } 198 }
199 return Success; 199 return Success;
200} 200}
201 201
202/*- 202/*-
203 *----------------------------------------------------------------------- 203 *-----------------------------------------------------------------------
204 * x68kMouseCtrl -- 204 * x68kMouseCtrl --
205 * Alter the control parameters for the mouse. Since acceleration 205 * Alter the control parameters for the mouse. Since acceleration
206 * etc. is done from the PtrCtrl record in the mouse's device record, 206 * etc. is done from the PtrCtrl record in the mouse's device record,
207 * there's nothing to do here. 207 * there's nothing to do here.
208 * 208 *
@@ -236,27 +236,27 @@ x68kMouseCtrl(DeviceIntPtr device, PtrCt @@ -236,27 +236,27 @@ x68kMouseCtrl(DeviceIntPtr device, PtrCt
236 */ 236 */
237 237
238Firm_event * 238Firm_event *
239x68kMouseGetEvents(int fd, int *pNumEvents, Bool *pAgain) 239x68kMouseGetEvents(int fd, int *pNumEvents, Bool *pAgain)
240{ 240{
241 int nBytes; /* number of bytes of events available. */ 241 int nBytes; /* number of bytes of events available. */
242 static Firm_event evBuf[X68K_MAXEVENTS]; /* Buffer for Firm_events */ 242 static Firm_event evBuf[X68K_MAXEVENTS]; /* Buffer for Firm_events */
243 243
244 if ((nBytes = read (fd, (char *)evBuf, sizeof(evBuf))) == -1) { 244 if ((nBytes = read (fd, (char *)evBuf, sizeof(evBuf))) == -1) {
245 if (errno == EWOULDBLOCK) { 245 if (errno == EWOULDBLOCK) {
246 *pNumEvents = 0; 246 *pNumEvents = 0;
247 *pAgain = FALSE; 247 *pAgain = FALSE;
248 } else { 248 } else {
249 ErrorF("x68kMouseGetEvents read"); 249 ErrorF("x68kMouseGetEvents read\n");
250 FatalError ("Could not read from mouse"); 250 FatalError ("Could not read from mouse");
251 } 251 }
252 } else { 252 } else {
253 *pNumEvents = nBytes / sizeof (Firm_event); 253 *pNumEvents = nBytes / sizeof (Firm_event);
254 *pAgain = (nBytes == sizeof (evBuf)); 254 *pAgain = (nBytes == sizeof (evBuf));
255 } 255 }
256 return evBuf; 256 return evBuf;
257} 257}
258 258
259/*- 259/*-
260 *----------------------------------------------------------------------- 260 *-----------------------------------------------------------------------
261 * x68kMouseEnqueueEvent -- 261 * x68kMouseEnqueueEvent --
262 * Given a Firm_event for a mouse, pass it off the the dix layer 262 * Given a Firm_event for a mouse, pass it off the the dix layer

cvs diff -r1.10 -r1.11 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c (expand / switch to unified diff)

--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c 2020/11/04 17:16:13 1.10
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c 2021/03/11 12:08:57 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x68kKbd.c,v 1.10 2020/11/04 17:16:13 tsutsui Exp $ */ 1/* $NetBSD: x68kKbd.c,v 1.11 2021/03/11 12:08:57 tsutsui Exp $ */
2/*------------------------------------------------------------------------- 2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki 3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -111,52 +111,52 @@ x68kKbdHandlerNotify(int fd __unused, in @@ -111,52 +111,52 @@ x68kKbdHandlerNotify(int fd __unused, in
111int 111int
112x68kKbdProc(DeviceIntPtr pDev, /* Keyboard to manipulate */ 112x68kKbdProc(DeviceIntPtr pDev, /* Keyboard to manipulate */
113 int what) /* What to do to it */ 113 int what) /* What to do to it */
114{ 114{
115 DevicePtr pKeyboard = &pDev->public; 115 DevicePtr pKeyboard = &pDev->public;
116 CARD8 x68kModMap[MAP_LENGTH]; 116 CARD8 x68kModMap[MAP_LENGTH];
117 int mode; 117 int mode;
118 XkbRMLVOSet rmlvo; 118 XkbRMLVOSet rmlvo;
119 119
120 switch (what) { 120 switch (what) {
121 case DEVICE_INIT: 121 case DEVICE_INIT:
122 pKeyboard->devicePrivate = (void *)&x68kKbdPriv; 122 pKeyboard->devicePrivate = (void *)&x68kKbdPriv;
123 if( (x68kKbdPriv.fd = open("/dev/kbd", O_RDONLY)) == -1 ) { 123 if( (x68kKbdPriv.fd = open("/dev/kbd", O_RDONLY)) == -1 ) {
124 ErrorF("Can't open keyboard device"); 124 ErrorF("Can't open keyboard device\n");
125 return !Success; 125 return !Success;
126 } 126 }
127 pKeyboard->on = FALSE; 127 pKeyboard->on = FALSE;
128 x68kInitModMap(x68kKeySyms, x68kModMap); 128 x68kInitModMap(x68kKeySyms, x68kModMap);
129 129
130 x68kInitKbdNames(&rmlvo, pKeyboard->devicePrivate); 130 x68kInitKbdNames(&rmlvo, pKeyboard->devicePrivate);
131#if 0 /* XXX How should we setup XKB maps for non PS/2 keyboard!? */ 131#if 0 /* XXX How should we setup XKB maps for non PS/2 keyboard!? */
132 InitKeyboardDeviceStruct(pDev, &rmlvo, 132 InitKeyboardDeviceStruct(pDev, &rmlvo,
133 x68kKbdBell, x68kKbdCtrl); 133 x68kKbdBell, x68kKbdCtrl);
134#else 134#else
135 InitKeyboardDeviceStruct(pDev, NULL, 135 InitKeyboardDeviceStruct(pDev, NULL,
136 x68kKbdBell, x68kKbdCtrl); 136 x68kKbdBell, x68kKbdCtrl);
137 XkbApplyMappingChange(pDev, x68kKeySyms, 137 XkbApplyMappingChange(pDev, x68kKeySyms,
138 x68kKeySyms->minKeyCode, 138 x68kKeySyms->minKeyCode,
139 x68kKeySyms->maxKeyCode - x68kKeySyms->minKeyCode + 1, 139 x68kKeySyms->maxKeyCode - x68kKeySyms->minKeyCode + 1,
140 x68kModMap, serverClient); 140 x68kModMap, serverClient);
141#endif 141#endif
142 break; 142 break;
143 143
144 case DEVICE_ON: 144 case DEVICE_ON:
145 mode = 1; 145 mode = 1;
146 if ( fcntl(x68kKbdPriv.fd, F_SETOWN, getpid()) == -1 || 146 if ( fcntl(x68kKbdPriv.fd, F_SETOWN, getpid()) == -1 ||
147 fcntl(x68kKbdPriv.fd, F_SETFL, O_NONBLOCK|O_ASYNC) == -1 || 147 fcntl(x68kKbdPriv.fd, F_SETFL, O_NONBLOCK|O_ASYNC) == -1 ||
148 ioctl(x68kKbdPriv.fd, KIOCSDIRECT, &mode) == -1 ) { 148 ioctl(x68kKbdPriv.fd, KIOCSDIRECT, &mode) == -1 ) {
149 ErrorF("Async keyboard I/O failed"); 149 ErrorF("Async keyboard I/O failed\n");
150 return !Success; 150 return !Success;
151 } 151 }
152 x68kSetLeds(&x68kKbdPriv, (uint8_t)x68kKbdPriv.leds); 152 x68kSetLeds(&x68kKbdPriv, (uint8_t)x68kKbdPriv.leds);
153 SetNotifyFd(x68kKbdPriv.fd, x68kKbdHandlerNotify, 153 SetNotifyFd(x68kKbdPriv.fd, x68kKbdHandlerNotify,
154 X_NOTIFY_READ, NULL); 154 X_NOTIFY_READ, NULL);
155 pKeyboard->on = TRUE; 155 pKeyboard->on = TRUE;
156 break; 156 break;
157 157
158 case DEVICE_CLOSE: 158 case DEVICE_CLOSE:
159 case DEVICE_OFF: 159 case DEVICE_OFF:
160 RemoveNotifyFd(x68kKbdPriv.fd); 160 RemoveNotifyFd(x68kKbdPriv.fd);
161 pKeyboard->on = FALSE; 161 pKeyboard->on = FALSE;
162 break; 162 break;
@@ -261,27 +261,27 @@ x68kInitKbdNames(XkbRMLVOSet *rmlvo, X68 @@ -261,27 +261,27 @@ x68kInitKbdNames(XkbRMLVOSet *rmlvo, X68
261 *----------------------------------------------------------------------- 261 *-----------------------------------------------------------------------
262 */ 262 */
263Firm_event * 263Firm_event *
264x68kKbdGetEvents(int fd, int *pNumEvents, Bool *pAgain) 264x68kKbdGetEvents(int fd, int *pNumEvents, Bool *pAgain)
265{ 265{
266 int nBytes; /* number of bytes of events available. */ 266 int nBytes; /* number of bytes of events available. */
267 static Firm_event evBuf[X68K_MAXEVENTS]; /* Buffer for Firm_events */ 267 static Firm_event evBuf[X68K_MAXEVENTS]; /* Buffer for Firm_events */
268 268
269 if ((nBytes = read (fd, evBuf, sizeof(evBuf))) == -1) { 269 if ((nBytes = read (fd, evBuf, sizeof(evBuf))) == -1) {
270 if (errno == EWOULDBLOCK) { 270 if (errno == EWOULDBLOCK) {
271 *pNumEvents = 0; 271 *pNumEvents = 0;
272 *pAgain = FALSE; 272 *pAgain = FALSE;
273 } else { 273 } else {
274 ErrorF("Reading keyboard"); 274 ErrorF("Reading keyboard\n");
275 FatalError ("Could not read the keyboard"); 275 FatalError ("Could not read the keyboard");
276 } 276 }
277 } else { 277 } else {
278 *pNumEvents = nBytes / sizeof (Firm_event); 278 *pNumEvents = nBytes / sizeof (Firm_event);
279 *pAgain = (nBytes == sizeof (evBuf)); 279 *pAgain = (nBytes == sizeof (evBuf));
280 } 280 }
281 return evBuf; 281 return evBuf;
282} 282}
283 283
284/*- 284/*-
285 *----------------------------------------------------------------------- 285 *-----------------------------------------------------------------------
286 * x68kKbdEnqueueEvent -- 286 * x68kKbdEnqueueEvent --
287 * 287 *
@@ -314,33 +314,33 @@ x68kKbdEnqueueEvent(DeviceIntPtr pDev, F @@ -314,33 +314,33 @@ x68kKbdEnqueueEvent(DeviceIntPtr pDev, F
314 */ 314 */
315 315
316static void 316static void
317x68kKbdRingBell(DeviceIntPtr pDev, int volume, int duration) 317x68kKbdRingBell(DeviceIntPtr pDev, int volume, int duration)
318{ 318{
319 int kbdCmd; /* Command to give keyboard */ 319 int kbdCmd; /* Command to give keyboard */
320 X68kKbdPrivPtr pPriv = (X68kKbdPrivPtr)pDev->public.devicePrivate; 320 X68kKbdPrivPtr pPriv = (X68kKbdPrivPtr)pDev->public.devicePrivate;
321 321
322 if (volume == 0) 322 if (volume == 0)
323 return; 323 return;
324 324
325 kbdCmd = KBD_CMD_BELL; 325 kbdCmd = KBD_CMD_BELL;
326 if (ioctl (pPriv->fd, KIOCCMD, &kbdCmd) == -1) { 326 if (ioctl (pPriv->fd, KIOCCMD, &kbdCmd) == -1) {
327 ErrorF("Failed to activate bell"); 327 ErrorF("Failed to activate bell\n");
328 return; 328 return;
329 } 329 }
330 usleep (duration * 1000); 330 usleep (duration * 1000);
331 kbdCmd = KBD_CMD_NOBELL; 331 kbdCmd = KBD_CMD_NOBELL;
332 if (ioctl (pPriv->fd, KIOCCMD, &kbdCmd) == -1) 332 if (ioctl (pPriv->fd, KIOCCMD, &kbdCmd) == -1)
333 ErrorF("Failed to deactivate bell"); 333 ErrorF("Failed to deactivate bell\n");
334} 334}
335 335
336static void 336static void
337x68kKbdBell(int volume, DeviceIntPtr pDev, void *ctrl, int unused) 337x68kKbdBell(int volume, DeviceIntPtr pDev, void *ctrl, int unused)
338{ 338{
339 KeybdCtrl* kctrl = (KeybdCtrl*) ctrl; 339 KeybdCtrl* kctrl = (KeybdCtrl*) ctrl;
340 340
341 if (kctrl->bell == 0) 341 if (kctrl->bell == 0)
342 return; 342 return;
343 343
344 x68kKbdRingBell(pDev, volume, kctrl->bell_duration); 344 x68kKbdRingBell(pDev, volume, kctrl->bell_duration);
345} 345}
346 346
@@ -389,23 +389,23 @@ x68kKbdCtrl(DeviceIntPtr pDev, KeybdCtrl @@ -389,23 +389,23 @@ x68kKbdCtrl(DeviceIntPtr pDev, KeybdCtrl
389/*------------------------------------------------------------------------- 389/*-------------------------------------------------------------------------
390 * function "x68kSetLeds" 390 * function "x68kSetLeds"
391 * 391 *
392 * purpose: set keyboard leds to specified state 392 * purpose: set keyboard leds to specified state
393 * argument: (X68kKbdPrivPtr)pPriv 393 * argument: (X68kKbdPrivPtr)pPriv
394 * (uint8_t)data; 394 * (uint8_t)data;
395 * returns: nothing 395 * returns: nothing
396 *-----------------------------------------------------------------------*/ 396 *-----------------------------------------------------------------------*/
397static void 397static void
398x68kSetLeds(X68kKbdPrivPtr pPriv, uint8_t data) 398x68kSetLeds(X68kKbdPrivPtr pPriv, uint8_t data)
399{ 399{
400 /* bit sequence of led indicator in xkb and hardware are same */ 400 /* bit sequence of led indicator in xkb and hardware are same */
401 if (ioctl(pPriv->fd, KIOCSLED, &data) == -1) 401 if (ioctl(pPriv->fd, KIOCSLED, &data) == -1)
402 ErrorF("Failed to set keyboard lights"); 402 ErrorF("Failed to set keyboard lights\n");
403} 403}
404 404
405Bool 405Bool
406LegalModifier(unsigned int key, DeviceIntPtr pDev) 406LegalModifier(unsigned int key, DeviceIntPtr pDev)
407{ 407{
408 return TRUE; 408 return TRUE;
409} 409}
410 410
411/* EOF x68kKbd.c */ 411/* EOF x68kKbd.c */

cvs diff -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c (expand / switch to unified diff)

--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c 2020/11/04 17:16:13 1.5
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c 2021/03/11 12:08:57 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x68kText.c,v 1.5 2020/11/04 17:16:13 tsutsui Exp $ */ 1/* $NetBSD: x68kText.c,v 1.6 2021/03/11 12:08:57 tsutsui Exp $ */
2/*------------------------------------------------------------------------- 2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki 3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -89,27 +89,27 @@ x68kTextClose(X68kScreenRec *pPriv) @@ -89,27 +89,27 @@ x68kTextClose(X68kScreenRec *pPriv)
89 * (int)argc, (char **)argv : standard C arguments 89 * (int)argc, (char **)argv : standard C arguments
90 * returns: (Bool) TRUE if succeeded 90 * returns: (Bool) TRUE if succeeded
91 * FALSE otherwise 91 * FALSE otherwise
92 *-----------------------------------------------------------------------*/ 92 *-----------------------------------------------------------------------*/
93Bool 93Bool
94x68kTextInit(ScreenPtr pScreen, int argc, char *argv[]) 94x68kTextInit(ScreenPtr pScreen, int argc, char *argv[])
95{ 95{
96 X68kScreenRec *pPriv; 96 X68kScreenRec *pPriv;
97 97
98 /* get private screen record set by X68KConfig */ 98 /* get private screen record set by X68KConfig */
99 pPriv = x68kGetScreenRecByType(X68K_FB_TEXT); 99 pPriv = x68kGetScreenRecByType(X68K_FB_TEXT);
100 100
101 if ( !dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0) ) { 101 if ( !dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0) ) {
102 ErrorF("dixRegisterPrivateKey failed"); 102 ErrorF("dixRegisterPrivateKey failed\n");
103 return FALSE; 103 return FALSE;
104 } 104 }
105 x68kSetScreenPrivate(pScreen, pPriv); 105 x68kSetScreenPrivate(pScreen, pPriv);
106 106
107 if ( !fbScreenInit(pScreen, pPriv->fb, 107 if ( !fbScreenInit(pScreen, pPriv->fb,
108 pPriv->scr_width, pPriv->scr_height, 108 pPriv->scr_width, pPriv->scr_height,
109 pPriv->dpi, pPriv->dpi, pPriv->fb_width, 1) ) 109 pPriv->dpi, pPriv->dpi, pPriv->fb_width, 1) )
110 return FALSE; 110 return FALSE;
111 pScreen->whitePixel = 1; 111 pScreen->whitePixel = 1;
112 pScreen->blackPixel = 0; 112 pScreen->blackPixel = 0;
113 if ( !miDCInitialize(pScreen, &x68kPointerScreenFuncs) ) 113 if ( !miDCInitialize(pScreen, &x68kPointerScreenFuncs) )
114 return FALSE; 114 return FALSE;
115 if ( !miCreateDefColormap(pScreen) ) 115 if ( !miCreateDefColormap(pScreen) )