Commit 3e5dbc694a41ee0a79c9e6136411ed4bc0bf6b07

Sam Lantinga 2018-08-21T13:29:21

Added a dummy sensor driver

1
2
3
4
5
6
7
8
9
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
diff --git a/Makefile.minimal b/Makefile.minimal
index 67a9137..7f02649 100644
--- a/Makefile.minimal
+++ b/Makefile.minimal
@@ -23,6 +23,7 @@ SOURCES = \
 	src/render/*.c \
 	src/render/software/*.c \
 	src/sensor/*.c \
+	src/sensor/dummy/*.c \
 	src/stdlib/*.c \
 	src/thread/*.c \
 	src/thread/generic/*.c \
diff --git a/Makefile.pandora b/Makefile.pandora
index 325d24e..f4cb668 100644
--- a/Makefile.pandora
+++ b/Makefile.pandora
@@ -12,15 +12,38 @@ CFLAGS  = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp
 
 TARGET  = libSDL.a
 
-SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
-	./src/file/*.c ./src/sensor/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
-	./src/joystick/*.c ./src/haptic/*.c ./src/power/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
-	./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \
-	./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
-	./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
-	./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \
-	./src/atomic/*.c ./src/filesystem/unix/*.c \
-	./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c 
+SOURCES = 
+	./src/*.c \
+	./src/atomic/*.c \
+	./src/audio/*.c \
+	./src/audio/disk/*.c \
+	./src/audio/dsp/*.c \
+	./src/audio/dummy/*.c \
+	./src/cpuinfo/*.c \
+	./src/events/*.c \
+	./src/file/*.c \
+	./src/filesystem/unix/*.c \
+	./src/haptic/*.c \
+	./src/haptic/linux/*.c \
+	./src/joystick/*.c \
+	./src/joystick/linux/*.c \
+	./src/loadso/dlopen/*.c \
+	./src/power/*.c \
+	./src/sensor/*.c \
+	./src/sensor/dummy/*.c \
+	./src/stdlib/*.c \
+	./src/thread/*.c \
+	./src/thread/pthread/SDL_syscond.c \
+	./src/thread/pthread/SDL_sysmutex.c \
+	./src/thread/pthread/SDL_syssem.c \
+	./src/thread/pthread/SDL_systhread.c \
+	./src/timer/*.c \
+	./src/timer/unix/*.c \
+	./src/video/*.c \
+	./src/video/dummy/*.c \
+	./src/video/pandora/SDL_pandora.o \
+	./src/video/pandora/SDL_pandora_events.o \
+	./src/video/x11/*.c \
 	
 
 OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
diff --git a/Makefile.psp b/Makefile.psp
index d6133b2..de0e50e 100644
--- a/Makefile.psp
+++ b/Makefile.psp
@@ -43,6 +43,7 @@ OBJS= src/SDL.o \
       src/render/software/SDL_render_sw.o \
       src/render/software/SDL_rotate.o \
       src/sensor/SDL_sensor.o \
+      src/sensor/dummy/SDL_dummysensor.o \
       src/stdlib/SDL_getenv.o \
       src/stdlib/SDL_iconv.o \
       src/stdlib/SDL_malloc.o \
diff --git a/Makefile.wiz b/Makefile.wiz
index 4ff91f4..8ed58ee 100644
--- a/Makefile.wiz
+++ b/Makefile.wiz
@@ -12,14 +12,33 @@ CFLAGS  = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE
 TARGET_STATIC  = libSDL2.a
 TARGET_SHARED  = libSDL2.so
 
-SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
-	./src/file/*.c ./src/sensor/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
-	./src/joystick/*.c ./src/haptic/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
-	./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \
-	./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
-	./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
-	./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \
-	./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o
+SOURCES = \
+	./src/*.c \
+	./src/audio/*.c \
+	./src/audio/disk/*.c \
+	./src/audio/dsp/*.c \
+	./src/audio/dummy/*.c \
+	./src/cpuinfo/*.c \
+	./src/events/*.c \
+	./src/file/*.c \
+	./src/haptic/*.c \
+	./src/haptic/linux/*.c \
+	./src/joystick/*.c \
+	./src/joystick/linux/*.c \
+	./src/loadso/dlopen/*.c \
+	./src/sensor/*.c \
+	./src/sensor/dummy/*.c \
+	./src/stdlib/*.c \
+	./src/thread/*.c \
+	./src/thread/pthread/SDL_syscond.c \
+	./src/thread/pthread/SDL_sysmutex.c \
+	./src/thread/pthread/SDL_syssem.c \
+	./src/thread/pthread/SDL_systhread.c \
+	./src/timer/*.c \
+	./src/timer/unix/*.c \
+	./src/video/*.c \
+	./src/video/dummy/*.c \
+	./src/video/pandora/*.c \
 	
 
 OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index c45fae8..c6b3df6 100755
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -913,6 +913,12 @@
 		F30D9C8A212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
 		F30D9C8B212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
 		F30D9C8C212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
+		F30D9C90212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; };
+		F30D9C91212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; };
+		F30D9C92212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; };
+		F30D9C93212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; };
+		F30D9C94212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; };
+		F30D9C95212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; };
 		F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1244,6 +1250,8 @@
 		F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor_c.h; sourceTree = "<group>"; };
 		F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syssensor.h; sourceTree = "<group>"; };
 		F30D9C83212BC94F0047DF2E /* SDL_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sensor.c; sourceTree = "<group>"; };
+		F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummysensor.h; sourceTree = "<group>"; };
+		F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummysensor.c; sourceTree = "<group>"; };
 		F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = "<group>"; };
 		F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
 		F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
@@ -1998,9 +2006,19 @@
 			name = "Linked Frameworks";
 			sourceTree = "<group>";
 		};
+		F30D9C8D212CABB40047DF2E /* dummy */ = {
+			isa = PBXGroup;
+			children = (
+				F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */,
+				F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */,
+			);
+			path = dummy;
+			sourceTree = "<group>";
+		};
 		F3950CDB212BC8BC00F51292 /* sensor */ = {
 			isa = PBXGroup;
 			children = (
+				F30D9C8D212CABB40047DF2E /* dummy */,
 				F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */,
 				F30D9C83212BC94F0047DF2E /* SDL_sensor.c */,
 				F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */,
@@ -2189,6 +2207,7 @@
 				04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */,
 				56A67027185654B40007D20F /* SDL_dynapi.h in Headers */,
 				04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */,
+				F30D9C90212CABDC0047DF2E /* SDL_dummysensor.h in Headers */,
 				04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */,
 				04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */,
 				0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */,
@@ -2298,6 +2317,7 @@
 				04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */,
 				04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */,
 				5C2EF6FC1FC9EE64003F5197 /* SDL_rect_c.h in Headers */,
+				F30D9C91212CABDC0047DF2E /* SDL_dummysensor.h in Headers */,
 				04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */,
 				04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */,
 				04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */,
@@ -2467,6 +2487,7 @@
 				DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */,
 				DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */,
 				5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */,
+				F30D9C92212CABDC0047DF2E /* SDL_dummysensor.h in Headers */,
 				DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */,
 				DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */,
 				DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */,
@@ -2804,6 +2825,7 @@
 				AADC5A441FDA035D00960936 /* SDL_render_metal.m in Sources */,
 				04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */,
 				04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */,
+				F30D9C93212CABDC0047DF2E /* SDL_dummysensor.c in Sources */,
 				5C2EF6F81FC9EE35003F5197 /* SDL_egl.c in Sources */,
 				04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */,
 				04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */,
@@ -2940,6 +2962,7 @@
 				AADC5A451FDA047900960936 /* SDL_render_metal.m in Sources */,
 				041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */,
 				04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
+				F30D9C94212CABDC0047DF2E /* SDL_dummysensor.c in Sources */,
 				04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */,
 				04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
 				04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */,
@@ -3076,6 +3099,7 @@
 				AADC5A481FDA048100960936 /* SDL_render_metal.m in Sources */,
 				DB31405817554B71006C0E22 /* SDL_render.c in Sources */,
 				DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */,
+				F30D9C95212CABDC0047DF2E /* SDL_dummysensor.c in Sources */,
 				DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */,
 				DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */,
 				DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */,
diff --git a/configure b/configure
index 2ed38ec..e88b380 100755
--- a/configure
+++ b/configure
@@ -24135,6 +24135,18 @@ $as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h
             ;;
           esac
         fi
+        # Set up files for the sensor library
+        if test x$enable_sensor = xyes; then
+          case $ARCH in
+            android)
+
+$as_echo "#define SDL_SENSOR_ANDROID 1" >>confdefs.h
+
+                SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
+                have_sensor=yes
+            ;;
+          esac
+        fi
         # Set up files for the power library
         if test x$enable_power = xyes; then
              case $ARCH in
@@ -24794,6 +24806,14 @@ $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h
     fi
     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
 fi
+if test x$have_sensor != xyes; then
+    if test x$enable_sensor = xyes; then
+
+$as_echo "#define SDL_SENSOR_DISABLED 1" >>confdefs.h
+
+    fi
+    SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
+fi
 if test x$have_threads != xyes; then
     if test x$enable_threads = xyes; then
 
diff --git a/configure.in b/configure.in
index 2136637..5bf5d71 100644
--- a/configure.in
+++ b/configure.in
@@ -3503,6 +3503,16 @@ case "$host" in
             ;;
           esac
         fi
+        # Set up files for the sensor library
+        if test x$enable_sensor = xyes; then
+          case $ARCH in
+            android)
+                AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ])
+                SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
+                have_sensor=yes
+            ;;
+          esac
+        fi
         # Set up files for the power library
         if test x$enable_power = xyes; then
              case $ARCH in
@@ -3998,6 +4008,12 @@ if test x$have_haptic != xyes; then
     fi
     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
 fi
+if test x$have_sensor != xyes; then
+    if test x$enable_sensor = xyes; then
+        AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ])
+    fi
+    SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
+fi
 if test x$have_threads != xyes; then
     if test x$enable_threads = xyes; then
         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index e69c272..f46984b 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -223,6 +223,7 @@
 #cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
 #cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
 #cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
+#cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@
 #cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
 #cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
 #cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
@@ -287,6 +288,10 @@
 #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
 #cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
 
+/* Enable various sensor drivers */
+#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
+#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
+
 /* Enable various shared object loading systems */
 #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
 #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 069539e..45a80ae 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -223,6 +223,7 @@
 #undef SDL_FILE_DISABLED
 #undef SDL_JOYSTICK_DISABLED
 #undef SDL_HAPTIC_DISABLED
+#undef SDL_SENSOR_DISABLED
 #undef SDL_LOADSO_DISABLED
 #undef SDL_RENDER_DISABLED
 #undef SDL_THREADS_DISABLED
@@ -288,6 +289,10 @@
 #undef SDL_HAPTIC_DINPUT
 #undef SDL_HAPTIC_XINPUT
 
+/* Enable various sensor drivers */
+#undef SDL_SENSOR_ANDROID
+#undef SDL_SENSOR_DUMMY
+
 /* Enable various shared object loading systems */
 #undef SDL_LOADSO_DLOPEN
 #undef SDL_LOADSO_DUMMY
diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h
index 080fd85..c103b29 100644
--- a/include/SDL_config_iphoneos.h
+++ b/include/SDL_config_iphoneos.h
@@ -139,6 +139,9 @@
 #define SDL_JOYSTICK_MFI 1
 #define SDL_JOYSTICK_HIDAPI 1
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable Unix style SO loading */
 #define SDL_LOADSO_DLOPEN 1
 
diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
index 5e0f836..9ebd4a3 100644
--- a/include/SDL_config_macosx.h
+++ b/include/SDL_config_macosx.h
@@ -140,6 +140,9 @@
 #define SDL_JOYSTICK_HIDAPI  1
 #define SDL_HAPTIC_IOKIT    1
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_DLOPEN   1
 
diff --git a/include/SDL_config_minimal.h b/include/SDL_config_minimal.h
index 5b03d8b..bf7fc44 100644
--- a/include/SDL_config_minimal.h
+++ b/include/SDL_config_minimal.h
@@ -64,6 +64,9 @@ typedef unsigned long uintptr_t;
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
 #define SDL_HAPTIC_DISABLED 1
 
+/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
+#define SDL_SENSOR_DISABLED 1
+
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
 #define SDL_LOADSO_DISABLED 1
 
diff --git a/include/SDL_config_pandora.h b/include/SDL_config_pandora.h
index b5b53a3..64111a1 100644
--- a/include/SDL_config_pandora.h
+++ b/include/SDL_config_pandora.h
@@ -114,6 +114,8 @@
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 
+#define SDL_SENSOR_DUMMY 1
+
 #define SDL_LOADSO_DLOPEN 1
 
 #define SDL_THREAD_PTHREAD 1
diff --git a/include/SDL_config_psp.h b/include/SDL_config_psp.h
index 0f835be..2422672 100644
--- a/include/SDL_config_psp.h
+++ b/include/SDL_config_psp.h
@@ -128,22 +128,25 @@
 /* PSP isn't that sophisticated */
 #define LACKS_SYS_MMAN_H 1
 
-/* Enable the stub thread support (src/thread/psp/\*.c) */
+/* Enable the PSP thread support (src/thread/psp/\*.c) */
 #define SDL_THREAD_PSP  1
 
-/* Enable the stub timer support (src/timer/psp/\*.c) */
+/* Enable the PSP timer support (src/timer/psp/\*.c) */
 #define SDL_TIMERS_PSP  1
 
-/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
+/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */
 #define SDL_JOYSTICK_PSP        1
 
-/* Enable the stub audio driver (src/audio/psp/\*.c) */
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
+/* Enable the PSP audio driver (src/audio/psp/\*.c) */
 #define SDL_AUDIO_DRIVER_PSP    1
 
-/* PSP video dirver */
+/* PSP video driver */
 #define SDL_VIDEO_DRIVER_PSP   1
 
-/* PSP render dirver */
+/* PSP render driver */
 #define SDL_VIDEO_RENDER_PSP   1
 
 #define SDL_POWER_PSP          1
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index 2a208f8..4aa06f7 100644
--- a/include/SDL_config_windows.h
+++ b/include/SDL_config_windows.h
@@ -194,6 +194,9 @@ typedef unsigned int uintptr_t;
 #define SDL_HAPTIC_DINPUT   1
 #define SDL_HAPTIC_XINPUT   1
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_WINDOWS  1
 
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index 6760735..568b421 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -192,6 +192,9 @@ typedef unsigned int uintptr_t;
 #define SDL_HAPTIC_XINPUT   1
 #endif
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_WINDOWS  1
 
diff --git a/include/SDL_config_wiz.h b/include/SDL_config_wiz.h
index 9b1f633..b6c00d0 100644
--- a/include/SDL_config_wiz.h
+++ b/include/SDL_config_wiz.h
@@ -129,6 +129,8 @@
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 
+#define SDL_SENSOR_DUMMY  1
+
 #define SDL_LOADSO_DLOPEN 1
 
 #define SDL_THREAD_PTHREAD 1
diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c
index 8859f61..59b2457 100644
--- a/src/sensor/SDL_sensor.c
+++ b/src/sensor/SDL_sensor.c
@@ -33,12 +33,12 @@
 #endif
 
 static SDL_SensorDriver *SDL_sensor_drivers[] = {
-#if 0 //defined(__IPHONEOS__) || defined(__TVOS__)
-    &SDL_IOS_SensorDriver,
-#endif
 #ifdef SDL_SENSOR_ANDROID
     &SDL_ANDROID_SensorDriver,
 #endif
+#if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED)
+    &SDL_DUMMY_SensorDriver
+#endif
 };
 static SDL_Sensor *SDL_sensors = NULL;
 static SDL_bool SDL_updating_sensor = SDL_FALSE;
@@ -78,11 +78,6 @@ SDL_SensorInit(void)
     }
 #endif /* !SDL_EVENTS_DISABLED */
 
-    if (SDL_arraysize(SDL_sensor_drivers) == 0) {
-        /* What should we return here? We'll just return 0 with no sensors for now. */
-        status = 0;
-    }
-
     status = -1;
     for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) {
         if (SDL_sensor_drivers[i]->Init() >= 0) {
diff --git a/src/sensor/SDL_syssensor.h b/src/sensor/SDL_syssensor.h
index 39dffe0..ab80f8c 100644
--- a/src/sensor/SDL_syssensor.h
+++ b/src/sensor/SDL_syssensor.h
@@ -93,5 +93,6 @@ typedef struct _SDL_SensorDriver
 
 /* The available sensor drivers */
 extern SDL_SensorDriver SDL_ANDROID_SensorDriver;
+extern SDL_SensorDriver SDL_DUMMY_SensorDriver;
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/sensor/dummy/SDL_dummysensor.c b/src/sensor/dummy/SDL_dummysensor.c
new file mode 100644
index 0000000..0148c09
--- /dev/null
+++ b/src/sensor/dummy/SDL_dummysensor.c
@@ -0,0 +1,110 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_config.h"
+
+#if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED)
+
+#include "SDL_error.h"
+#include "SDL_sensor.h"
+#include "SDL_dummysensor.h"
+#include "../SDL_syssensor.h"
+
+static int
+SDL_DUMMY_SensorInit(void)
+{
+    return 0;
+}
+
+static int
+SDL_DUMMY_SensorGetCount(void)
+{
+    return 0;
+}
+
+static void
+SDL_DUMMY_SensorDetect(void)
+{
+}
+
+static const char *
+SDL_DUMMY_SensorGetDeviceName(int device_index)
+{
+    return NULL;
+}
+
+static SDL_SensorType
+SDL_DUMMY_SensorGetDeviceType(int device_index)
+{
+    return SDL_SENSOR_INVALID;
+}
+
+static int
+SDL_DUMMY_SensorGetDeviceNonPortableType(int device_index)
+{
+    return -1;
+}
+
+static SDL_SensorID
+SDL_DUMMY_SensorGetDeviceInstanceID(int device_index)
+{
+    return -1;
+}
+
+static int
+SDL_DUMMY_SensorOpen(SDL_Sensor *sensor, int device_index)
+{
+    return SDL_Unsupported();
+}
+    
+static void
+SDL_DUMMY_SensorUpdate(SDL_Sensor* sensor)
+{
+}
+
+static void
+SDL_DUMMY_SensorClose(SDL_Sensor * sensor)
+{
+}
+
+static void
+SDL_DUMMY_SensorQuit(void)
+{
+}
+
+SDL_SensorDriver SDL_DUMMY_SensorDriver =
+{
+    SDL_DUMMY_SensorInit,
+    SDL_DUMMY_SensorGetCount,
+    SDL_DUMMY_SensorDetect,
+    SDL_DUMMY_SensorGetDeviceName,
+    SDL_DUMMY_SensorGetDeviceType,
+    SDL_DUMMY_SensorGetDeviceNonPortableType,
+    SDL_DUMMY_SensorGetDeviceInstanceID,
+    SDL_DUMMY_SensorOpen,
+    SDL_DUMMY_SensorUpdate,
+    SDL_DUMMY_SensorClose,
+    SDL_DUMMY_SensorQuit,
+};
+
+#endif /* SDL_SENSOR_DUMMY || SDL_SENSOR_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/sensor/dummy/SDL_dummysensor.h b/src/sensor/dummy/SDL_dummysensor.h
new file mode 100644
index 0000000..507ee93
--- /dev/null
+++ b/src/sensor/dummy/SDL_dummysensor.h
@@ -0,0 +1,23 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+/* vi: set ts=4 sw=4 expandtab: */