File: convert-source-format3.0.patch

package info (click to toggle)
fnfx 0.3-18
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 680 kB
  • sloc: sh: 2,043; ansic: 1,811; makefile: 24
file content (434 lines) | stat: -rw-r--r-- 14,036 bytes parent folder | download | duplicates (2)
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
Description: Apply upstream source changes as patch.
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2017-01-25

--- fnfx-0.3.orig/README
+++ fnfx-0.3/README
@@ -114,6 +114,7 @@ every new Toshiba laptop really should w
 - Toshiba Portege 3440CT
 - Toshiba Portege 4000
 - Toshiba Portege 7020ct
+- Toshiba Portege M100
 - Toshiba Portege R100
 - Toshiba Satellite 1410-303
 - Toshiba Satellite 1410-604
--- /dev/null
+++ fnfx-0.3/changelog
@@ -0,0 +1,76 @@
+fnfx (0.3-9) unstable; urgency=low
+
+  * Applied Rami Lehti patch that adds support for systems using
+    /sys/power/state interface instead of the /proc/acpi/sleep 
+    which is deprecated. Patch sent to upstream.
+
+ -- Agney Lopes Roth Ferraz <agney@debian.org>  Sat, 20 May 2006 14:34:15 -0300
+
+fnfx (0.3-8) unstable; urgency=low
+
+  [ paolo ]
+  * fixed segv in debug mode - seems an shmem offset problem for
+    cfg->acpi.fnkey_descr.
+  * removed acpi.fnkey_descr which seems useless anyway.
+  * vsnprintf -> vfprintf in debug(), fatal().
+
+  [ Agney Lopes Roth Ferraz ]
+  * applied paolo patch (Closes: #363175) 
+
+ -- Agney Lopes Roth Ferraz <agney@debian.org>  Sat, 29 Apr 2006 21:42:49 -0300
+    
+fnfx (0.3-7) unstable; urgency=low
+
+  * Fixed Fn-keystrokes misses. Thanks to Konstantin Isakov. The fix will be
+    aplied on upstream source, but while this not happens it will be fixed on
+    debian. (Closes: #328085)
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Tue, 13 Sep 2005 17:22:21 -0300
+
+fnfx (0.3-6) unstable; urgency=low
+
+  * Removed unused helpers from rules.
+  * Updated policy version (no changes need).
+  
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Mon, 29 Aug 2005 12:34:31 -0300
+
+fnfx (0.3-5) unstable; urgency=low
+
+  * Changed target architectures in control file. (Closes: #300616)
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Sun, 20 Mar 2005 22:26:45 -0300
+
+fnfx (0.3-4) unstable; urgency=low
+
+  * removed article from the beginning of fnfx's and fnfx-client's description 
+  (Closes: #299984) 
+  
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Thu, 17 Mar 2005 14:15:55 -0300
+
+fnfx (0.3-3) unstable; urgency=low
+
+  * debian/control -> changed fnfx-client dependency. (Closes: #288525) 
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Thu,  6 Jan 2005 13:44:57 -0200
+
+fnfx (0.3-2) unstable; urgency=low
+
+  * Fixed path to configuration files. (Closes: #287067) 
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Fri, 24 Dec 2004 11:19:28 -0200
+
+fnfx (0.3-1) unstable; urgency=low
+
+  * New Upstream release (Closes: #285200) 
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Sat, 11 Dec 2004 16:41:35 -0200
+
+fnfx (0.2-2) unstable; urgency=low
+
+  * Initial Release. (Closes: #203067)
+  * First debian release is 2 because upstream already distributed debian
+    relase 1.
+
+ -- Agney Lopes Roth Ferraz <agney@users.sourceforge.net>  Sun,  8 Aug 2004 20:41:49 -0300
+
--- fnfx-0.3.orig/src/fnfx.c
+++ fnfx-0.3/src/fnfx.c
@@ -93,13 +93,12 @@ void debug(const char *fmt, ...)
 {
     if (cfg->flags & DEBUG) {
         va_list args;
-        char msgbuf[MSGBUFSIZE];
 
         va_start(args, fmt);
 
         fprintf(stdout, "debug: ");
-        vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
-        fprintf(stdout, "%s\r\n", msgbuf);
+        vfprintf(stdout, fmt, args);
+	putc('\n',stdout);
 
         va_end(args);
     }
@@ -115,13 +114,12 @@ void debug(const char *fmt, ...)
 void fatal(const char *fmt, ...)
 {
     va_list args;
-    char msgbuf[MSGBUFSIZE];
 
     va_start(args, fmt);
 
-    fprintf(stderr, "\nfatal error: ");
-    vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
-    fprintf(stderr, "%s\r\n\n", msgbuf);
+    fputs("\nfatal error: ",stderr);
+    vfprintf(stderr, fmt, args);
+    fputs("\n\n", stderr);
 
     va_end(args);
 }
@@ -218,10 +216,13 @@ void loop()
     while (1) {
         debug("loop() - Waiting for Fn-key combination.");
         wait_fnfxd();
-        debug("loop() - Received Fn-key combination (%s).",
-              daemon_cfg->acpi.fnkey_descr);
-        handle_fnkey();
-        signal_fnfxd();
+
+	if(daemon_cfg->acpi.fnkey_pos != -1) {
+          debug("loop() - Received Fn-key combination (%s).",
+              daemon_cfg->keymap.fnkey[daemon_cfg->acpi.fnkey_pos].descr);
+          handle_fnkey();
+          signal_fnfxd();
+	}
     }
 
 }
--- fnfx-0.3.orig/src/fnfx.h
+++ fnfx-0.3/src/fnfx.h
@@ -51,6 +51,7 @@
 #define ACPI_VERSION	"/proc/acpi/toshiba/version"
 #define ACPI_VIDEO	"/proc/acpi/toshiba/video"
 #define ACPI_SLEEP	"/proc/acpi/sleep"
+#define ACPI_STATE	"/sys/power/state"
 #define ACPI_CPU	"/proc/acpi/processor/CPU0/limit"
 #define ACPI_BLUETOOTH	"/proc/acpi/toshiba/bluetooth"
 
@@ -61,6 +62,7 @@
 #define VAL_VERSION	0x10
 #define VAL_VIDEO	0x20
 #define VAL_SLEEP	0x40
+#define VAL_STATE	0x80
 
 #define VIDEO_LCD	0x1
 #define VIDEO_CRT	0x2
@@ -91,16 +93,16 @@
 typedef struct {
     int volume;
     int config;
-    char device[MIXER_SIZE];
+    char device[MIXER_SIZE+1];
 } s_mixer;
 
 typedef struct {
     int value;
     int state;
 
-    char command[CMD_SIZE];
-    char client_command[CMD_SIZE];
-    char descr[LINE_SIZE];
+    char command[CMD_SIZE+1];
+    char client_command[CMD_SIZE+1];
+    char descr[LINE_SIZE+1];
 } s_fnkey;
 
 typedef struct {
@@ -124,7 +126,6 @@ typedef struct {
     int hotkey_ready;
     int hotkey;
 
-    char *fnkey_descr;
     int fnkey_pos;
 
     int config;
--- fnfx-0.3.orig/src/fnfx_cfg.c
+++ fnfx-0.3/src/fnfx_cfg.c
@@ -74,8 +74,8 @@ int handle_fnkey(void)
     if ((daemon_cfg->keymap.fnkey[i].state & FNKEY_ENABLED) &&
         strlen(daemon_cfg->keymap.fnkey[i].client_command)) {
         if (daemon_cfg->keymap.fnkey[i].state & FNKEY_EXTERNAL) {
-            char command[CMD_SIZE];
-            sprintf(command, "%s%1c",
+            char command[CMD_SIZE+2];
+            snprintf(command, CMD_SIZE+1, "%s%1c",
                     daemon_cfg->keymap.fnkey[i].client_command, '&');
 
             debug("handle_fnkey() - executing: %s", command);
@@ -177,7 +177,6 @@ int load_actions(FILE * f, char *line)
         if (!strncmp(line, "action(", 7)) {
             sscanf(line, "action(key=\"%[^\"]\";command=\"%[^\"]\")",
                    fnkey_descr, command);
-
             if ((strlen(fnkey_descr)) && (strlen(command))) {
                 for (i = 0; i < daemon_cfg->keymap.entries; i++) {
                     if (!
@@ -229,7 +228,6 @@ int init_config()
             if (!strncmp(line, "[actions]", 8))
                 load_actions(f, line);
         }
-
     }
     else {
         fatal
@@ -282,7 +280,7 @@ int init_config()
                     daemon_cfg->keymap.fnkey[i].state = 0;
                 }
             }
-            if (!(daemon_cfg->acpi.config & VAL_SLEEP)) {
+            if (!(daemon_cfg->acpi.config & VAL_SLEEP) && !(daemon_cfg->acpi.config & VAL_STATE)) {
                 if ((!
                      (strcmp
                       (daemon_cfg->keymap.fnkey[i].client_command,
@@ -292,10 +290,10 @@ int init_config()
                         "suspend to disk")))
                     ) {
                     debug
-                        ("error (non-fatal): The command \"%s\" is used for %s, but \"%s\" is not available. "
+                        ("error (non-fatal): The command \"%s\" is used for %s, but \"%s\" or \"%s\" is not available. "
                          "Disabling defined action.",
                          daemon_cfg->keymap.fnkey[i].client_command,
-                         daemon_cfg->keymap.fnkey[i].descr, ACPI_SLEEP);
+                         daemon_cfg->keymap.fnkey[i].descr, ACPI_SLEEP, ACPI_STATE);
                     strcpy(daemon_cfg->keymap.fnkey[i].client_command, "");
                     daemon_cfg->keymap.fnkey[i].state = 0;
 
--- fnfx-0.3.orig/src/fnfxd.c
+++ fnfx-0.3/src/fnfxd.c
@@ -97,13 +97,12 @@ void debug(const char *fmt, ...)
 {
     if (cfg->debug_flag == 1) {
         va_list args;
-        char msgbuf[MSGBUFSIZE];
 
         va_start(args, fmt);
 
         fprintf(stdout, "debug: ");
-        vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
-        fprintf(stdout, "%s\r\n", msgbuf);
+        vfprintf(stdout, fmt, args);
+        fputs("\n",stdout);
 
         va_end(args);
     }
@@ -119,13 +118,12 @@ void debug(const char *fmt, ...)
 void fatal(const char *fmt, ...)
 {
     va_list args;
-    char msgbuf[MSGBUFSIZE];
 
     va_start(args, fmt);
 
     fprintf(stderr, "\nfatal error: ");
-    vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
-    fprintf(stderr, "%s\r\n\n", msgbuf);
+    vfprintf(stderr, fmt, args);
+    fputs("\n",stderr);
 
     va_end(args);
 }
--- fnfx-0.3.orig/src/fnfxd_acpi.c
+++ fnfx-0.3/src/fnfxd_acpi.c
@@ -73,6 +73,9 @@ extern t_daemon_cfg *cfg;
 
 void signal_fnfx()
 {
+    /* Reset the remnant response from the client in case there is one */
+    semctl(cfg->sem.id, 2, SETVAL, 0);
+
     cfg->sem.op.sem_num = 1;
     cfg->sem.op.sem_op = 1;
     cfg->sem.op.sem_flg = 0;
@@ -155,9 +158,7 @@ int chk_fnkey()
 
         if (cfg->acpi.hotkey_ready) {
             fnkey_pos = lookup(cfg->acpi.hotkey);
-            cfg->acpi.fnkey_descr = cfg->keymap.fnkey[fnkey_pos].descr;
             cfg->acpi.fnkey_pos = fnkey_pos;
-
             if (fnkey_pos != -1) {
                 if (notify_client()) {
                     if (cfg->debug_flag)
--- fnfx-0.3.orig/src/fnfxd_cfg.c
+++ fnfx-0.3/src/fnfxd_cfg.c
@@ -24,8 +24,8 @@
  *
  */
 
-#define KEYMAP		"/etc/fnfx/keymap"
-#define CONFIGFILE	"/etc/fnfx/fnfxd.conf"
+#define KEYMAP		"/etc/fnfxd/keymap"
+#define CONFIGFILE	"/etc/fnfxd/fnfxd.conf"
 
 /*
  * Includes
@@ -111,8 +111,10 @@ int load_keymap(FILE * f, char *line)
             /* Fill config.keymap.fnkey[] */
             sscanf(line, "key(value=0x%3x;description=\"%[^\"]\")",
                    &cfg->keymap.fnkey[i].value, cfg->keymap.fnkey[i].descr);
-
             /* If we have a somewhat malformed config line, remove entry */
+	    debug("cfg->keymap.fnkey[%d].descr=%s, len=%d", i, 
+		cfg->keymap.fnkey[i].descr, 
+		strlen(cfg->keymap.fnkey[i].descr));
             if (!strlen(cfg->keymap.fnkey[i].descr))
                 i -= 1;
             else
@@ -388,16 +390,16 @@ int init_config()
 
                 }
             }
-            if (!(cfg->acpi.config & VAL_SLEEP)) {
+            if (!(cfg->acpi.config & VAL_SLEEP) && !(cfg->acpi.config & VAL_STATE)) {
                 if ((!(strcmp(cfg->keymap.fnkey[i].command, "suspend to ram")))
                     ||
                     (!(strcmp(cfg->keymap.fnkey[i].command, "suspend to disk")))
                     ) {
                     debug
-                        ("error (non-fatal): The command \"%s\" is used for %s, but \"%s\" is not available. "
+                        ("error (non-fatal): The command \"%s\" is used for %s, but \"%s\" or \"%s\" is not available. "
                          "Disabling defined action.",
                          cfg->keymap.fnkey[i].command,
-                         cfg->keymap.fnkey[i].descr, ACPI_SLEEP);
+                         cfg->keymap.fnkey[i].descr, ACPI_SLEEP, ACPI_STATE);
                     strcpy(cfg->keymap.fnkey[i].command, "");
                     cfg->keymap.fnkey[i].state &= ~FNKEY_ENABLED;
                 }
--- fnfx-0.3.orig/src/fnfxd_cmds.c
+++ fnfx-0.3/src/fnfxd_cmds.c
@@ -354,13 +354,21 @@ int video_status(void)
 
 int suspend(int state)
 {
+    int using_state=0;
     FILE *f = fopen(ACPI_SLEEP, "r+");
 
     if (!f) {
-        debug("Error while opening %s. Could not suspend to ram.", ACPI_SLEEP);
-        return 0;
+	f = fopen(ACPI_STATE, "r+");
+	if (!f) {
+            debug("Error while opening %s and %s. Could not suspend to ram/disk.", ACPI_SLEEP, ACPI_STATE);
+            return 0;
+	}
+	else {
+	    debug("Error while open %s. Using %s instead.", ACPI_SLEEP, ACPI_STATE);
+	    using_state=1;
+	}
     }
-    else {
+    if (!using_state) {
         if (state == 3)
             fprintf(f, "%d", state);
         else if (state == 4)
@@ -372,6 +380,18 @@ int suspend(int state)
         fclose(f);
         return 0;
     }
+    else {
+	if (state == 3)
+	    fprintf(f, "mem\n");
+	else if ( state == 4)
+	    fprintf(f, "disk\n");
+	else {
+	    debug("suspend() - Not supported sleep state.");
+	    return 1;
+	}
+	fclose(f);
+	return 0;
+    }
 }
 
 int cpu_toggle()
--- fnfx-0.3.orig/src/fnfxd_init.c
+++ fnfx-0.3/src/fnfxd_init.c
@@ -239,7 +239,7 @@ int init_acpi()
     FILE *f;
     int i;
 
-    const char *acpi_proc_keys[9] = {
+    const char *acpi_proc_keys[10] = {
         ACPI_TOSHIBA,
         ACPI_FAN,
         ACPI_KEYS,
@@ -247,18 +247,19 @@ int init_acpi()
         ACPI_VERSION,
         ACPI_VIDEO,
         ACPI_SLEEP,
+        ACPI_STATE,
         ACPI_CPU,
         ACPI_BLUETOOTH
     };
 
-    for (i = 1; i < 7; i++) {
+    for (i = 1; i < 8; i++) {
         if ((f = fopen(acpi_proc_keys[i], "r+"))) {
             cfg->acpi.config |= 1 << i;
             fclose(f);
         }
         else if ((i == 2) || (i == 3)) {
 
-            fatal("Could open %s.", acpi_proc_keys[i]);
+            fatal("Could not open %s.", acpi_proc_keys[i]);
             fprintf(stderr,
                     "Please make sure that your kernel has enabled the Toshiba option in the ACPI section.\n"
                     "For more information read the documentation and/or http://fnfx.sf.net/index.php?section=doc#kernel.\n\n");