[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fn key on lombard (and up) powerbooks...

On Oct 09 2001, Colin Walters wrote:
> Josh Huber <huber@debian.org> writes:
> > It seems to work fine on my powerbook, which is great.
> It works fine for me too on my TiBook.

	It would work fine if I had more money to purchase one of
	these cool toys. :-)

> > So, my real question is this...how should this be integrated with
> > pmud-utils/pmud. (I think it should somehow be put in Debian)
> I think it should be integrated too, after applying the attached
> patch.  Doesn't anyone else compile with -Wall?

	Well, I think that it is wise to compile not only with -Wall
	but also with -ansi -pedantic -O2. This way, some further
	errors are catched.

	BTW, since n is an integer in that program, the format string
	of %ld is incorrect to deal with it and the correct fix is not
	to use a type cast, but to remove the l of the format string.
	The I think that the same should apply to the sz variable (but
	I'm not so sure about this one).

	Also, there is a problem with a format string, which has only
	%: and which should have %s instead.

	I'm sending a patch to the original program. Does it compile
	cleanly with other people's compilers? Here it doesn't but my
	build environment is broken anyway. :-(

	I haven't had the time to check this (I only glanced), but
	there are many variables called data, some defined with 32 and
	some defined with 16 bytes. Is that really correct?

	[]s, Roger...

P.S.: An unrelated question: I'm having some severe problems getting
the pmac 9500 working with OF (I can't for the life of me make this
thing send the output to the monitor).

Is the situation any better with newer machines (i.e., is the default
OF output the screen or does it still default to the serial port)?
  Rogério Brito - rbrito@ime.usp.br - http://www.ime.usp.br/~rbrito/
--- fnset.c.orig	Tue Oct  9 23:50:41 2001
+++ fnset.c	Tue Oct  9 23:44:37 2001
@@ -17,7 +17,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <stdlib.h>
+#include <string.h>
 #include <linux/adb.h>
 #include <linux/pmu.h>
@@ -61,7 +63,7 @@
     if (debug) {
 	int i;
-	fprintf(stderr, "writing %ld bytes: {", sz);
+	fprintf(stderr, "writing %d bytes: {", sz);
 	for (i = 0; i < sz; i++) {
 	    fprintf(stderr, " 0x%02x", data[i]);
@@ -74,7 +76,7 @@
 	    fprintf(stderr, "%s: write(): %s\n",
 		    prog, strerror(errno));
 	} else {
-	    fprintf(stderr, "%s: write(): expected %ld got %ld\n",
+	    fprintf(stderr, "%s: write(): expected %d got %d\n",
 		    prog, sz, n);
 	return -1;
@@ -96,7 +98,7 @@
     if (debug) {
 	int i;
-	fprintf(stderr, "read %ld bytes", n);
+	fprintf(stderr, "read %d bytes", n);
 	if (n > 0) {
 	    fputs(": {", stderr);
 	    for (i = 0; i < n; i++) {
@@ -129,7 +131,7 @@
 	return -1;
     if (n != 2) {
-	fprintf(stderr, "%s: read(): expected 2 got %ld\n",
+	fprintf(stderr, "%s: read(): expected 2 got %d\n",
 		prog, n);
 	return -1;
@@ -255,10 +257,9 @@
-main(int argc, char *argv[], char *envp[])
+main(int argc, char *argv[])
     const char *adb = "/dev/adb";
-    unsigned char data[32];
     const char *optlet = "dvhsubvP:";
     extern char *optarg;
@@ -365,7 +366,7 @@
     if (bitpos && !force) {
-		"%: WARNING: use of bit offset other than 0 (-P option)"
+		"%s: WARNING: use of bit offset other than 0 (-P option)"
 		"requires force (-f option) since it may damage hardware!\n",

Reply to: