Tue, 23 Apr 2024 20:45:29 +0200
Device Save implemented.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
2 | * Copyright (C) 2015-2024 |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include "brewpanel.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include "sdlgui.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | #include "dlgBrew.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
27 | #ifdef HAVE_SDL2_SDL_H |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | int debug = FALSE; /* Console debugging */ |
432
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
30 | static pid_t pgrp, mypid; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | int my_shutdown = FALSE; /* Shutdown requested */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | char *Paneltype = NULL; /* Panel to emulate */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | int PAN_x; /* Screen X size */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | int PAN_y; /* Screen Y size */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | int LCD_fcol; /* LCD foreground color */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | int LCD_bcol; /* LCD background color */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
39 | SDL_Surface *S_screen = NULL; /* Main screen */ |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
40 | SDL_Window *S_window; /* Main window */ |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
432
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
42 | int server(void); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
43 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | void help(void) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | fprintf(stdout, "Usage: brewpanel [-d] [-h] [-p <paneltype>]\n"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | fprintf(stdout, " -d --debug Debug on\n"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | fprintf(stdout, " -h --help Display this help\n"); |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
49 | fprintf(stdout, " -p --paneltype <ferm|brew> Select panel type\n"); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | void die(int onsig) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | switch (onsig) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | case SIGHUP: syslog(LOG_NOTICE, "Got SIGHUP, shutting down"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | case SIGINT: syslog(LOG_NOTICE, "Keyboard interrupt, shutting down"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | case SIGTERM: syslog(LOG_NOTICE, "Got SIGTERM, shutting down"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | case SIGSEGV: syslog(LOG_NOTICE, "Got SIGSEGV, shutting down"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | my_shutdown = TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | exit(SIGSEGV); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | default: syslog(LOG_NOTICE, "die() on signal %d", onsig); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | my_shutdown = TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | int main(int argc, char *argv[]) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | { |
432
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
77 | int i, c, rc = 0; |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
78 | pid_t frk; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | Paneltype = calloc(128, sizeof(char)); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | while (1) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | int option_index = 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | static struct option long_options[] = { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | {"debug", 0, 0, 'c'}, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | {"help", 0, 0, 'h'}, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | {"paneltype", 1, 0, 'p'}, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | {0, 0, 0, 0} |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | }; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | c = getopt_long(argc, argv, "dhp:", long_options, &option_index); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | if (c == -1) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | switch (c) { |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
96 | case 'd': debug = TRUE; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | case 'h': help(); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | return 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | case 'p': snprintf(Paneltype, 127, "%s", optarg); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | openlog("brewpanel", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_USER); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | syslog(LOG_NOTICE, "mbsePi-apps brewpanel v%s starting", VERSION); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | * but that's live. This daemon should only be stopped by SIGTERM. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | * Don't catch SIGCHLD. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | for (i = 0; i < NSIG; i++) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | if ((i != SIGCHLD) && (i != SIGKILL) && (i != SIGSTOP)) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | signal(i, (void (*))die); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | |
432
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
118 | if (debug) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
119 | /* |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
120 | * Run in foreground when debugging |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
121 | */ |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
122 | rc = server(); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
123 | } else { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
124 | /* |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
125 | * Fork the daemon |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
126 | */ |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
127 | if ((pgrp = setpgid(0, 0)) == -1) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
128 | syslog(LOG_NOTICE, "setpgpid failed"); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
129 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
130 | |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
131 | frk = fork(); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
132 | switch (frk) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
133 | case -1: |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
134 | syslog(LOG_NOTICE, "Daemon fork failed: %s", strerror(errno)); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
135 | exit(1); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
136 | case 0: /* |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
137 | * Run the daemon |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
138 | */ |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
139 | fclose(stdin); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
140 | if (open("/dev/null", O_RDONLY) != 0) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
141 | syslog(LOG_NOTICE, "Reopen of stdin to /dev/null failed"); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
142 | _exit(2); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
143 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
144 | fclose(stdout); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
145 | if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
146 | syslog(LOG_NOTICE, "Reopen of stdout to /dev/null failed"); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
147 | _exit(2); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
148 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
149 | fclose(stderr); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
150 | if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
151 | syslog(LOG_NOTICE, "Reopen of stderr to /dev/null failed"); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
152 | _exit(2); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
153 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
154 | mypid = getpid(); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
155 | rc = server(); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
156 | break; |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
157 | /* Not reached */ |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
158 | default: |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
159 | /* |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
160 | * Here we detach this process and let the child |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
161 | * run the deamon process. |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
162 | */ |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
163 | syslog(LOG_NOTICE, "Starting daemon with pid %d", frk); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
164 | exit(0); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
165 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
166 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
167 | |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
168 | syslog(LOG_NOTICE, "Finished, rc=%d", rc); |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
169 | return rc; |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
170 | } |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
171 | |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
172 | |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
173 | int server(void) |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
174 | { |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
175 | char title[81]; |
332daf75352e
The brewpanel can now run in daemon mode or debug mode.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
176 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | * Initialize defaults, Video and Audio |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | if ((SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO) == -1)) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | syslog(LOG_NOTICE, "[main] could not initialize SDL: %s", SDL_GetError()); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | exit(-1); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | } |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
184 | if ((TTF_Init() < 0)) { |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
185 | syslog(LOG_NOTICE, "[main] SDL_ttf could not initialize! SDL_ttf Error: %s", TTF_GetError()); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
186 | exit(-1); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
187 | } |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
188 | SDLGui_Init(); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
190 | /* |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
191 | * Get available fullscreen modes, so we will get the effective screensize |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
192 | */ |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
193 | SDL_DisplayMode modes = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 }; |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
194 | if (SDL_GetDisplayMode(0, 0, &modes) != 0) { |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
195 | syslog(LOG_NOTICE, "[main] SDL_GetDisplayMode failed: %s", SDL_GetError()); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
196 | exit(-1); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
198 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
199 | PAN_x = 384; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | PAN_y = 480; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
202 | snprintf(title, 80, "brewpanel v%s", VERSION); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
203 | S_window = SDL_CreateWindow(title, 0, 0, PAN_x, PAN_y, SDL_WINDOW_OPENGL); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
204 | |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
205 | S_screen = SDL_GetWindowSurface(S_window); |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
206 | if (S_screen == NULL) { |
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
207 | syslog(LOG_NOTICE, "Could not create S_screen: %s", SDL_GetError()); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | exit(-1); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | syslog(LOG_NOTICE, "Starting mainloop"); |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
213 | if (strlen(Paneltype) && !strcmp(Paneltype, (char *)"ferm") ) { |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
214 | Dialog_BrewDlg(1); |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
215 | } else { |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
216 | Dialog_BrewDlg(0); |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
217 | } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | syslog(LOG_NOTICE, "Out of mainloop, cleanup"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | SDLGui_UnInit(); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
574
diff
changeset
|
221 | SDL_FreeSurface(S_screen); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | SDL_Quit(); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | return 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
227 | #else |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
228 | |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
229 | int main(int argc, char *argv[]) |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
230 | { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
231 | fprintf(stderr, "brewpanel not compiled because SDL2 is missing.\n"); |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
232 | return 1; |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
233 | } |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
234 | |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
235 | #endif |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
236 |