Re: [concordance-devel] Failed with error 1

2008-10-18 Thread Andreas Schulz
On Thursday 16 October 2008, Phil Dibowitz wrote:
> On Wed, Oct 15, 2008 at 09:49:38PM -0400, Stuart Doherty wrote:
> > The command I use is:
> > sudo concordance -v -C Connectivity.EZHex
>
> That's a *connectivity* file, not a config file. Don't specify a mode
> (it'll figure it out) or use -t for connectivity test. Then you'll get a
> config.
>
> Can you file a bug and I'll add some better error handling code for this?

Phil,

Unless you haven't found something better already, I would suggest the
attached patch.

Note: in the original code, after:
   if (mode == MODE_UNSET && file_name) {
the check:
   if (file_name) {
will obviously always succeed, so the 'else' branch printing 'No mode'
will never be reached.

I also deleted:
-   err = 0;
as redundant, since it is immediately followed by:
err = init_concord();

Result of a test run:

[EMAIL PROTECTED] concordance]$ ./concordance -C ../../Files/Connectivity.EZHex
Concordance 0.20+CVS
Copyright 2007 Kevin Timmerman and Phil Dibowitz
This software is distributed under the GPLv3.

Error: Input file type recognized as: 
   does not match requested mode: 

Andreas
Index: concordance.c
RCS file: /cvsroot/concordance/concordance/concordance/concordance.c,v
retrieving revision 1.33
diff -u -3 -p -r1.33 concordance.c
--- concordance.c	12 Oct 2008 22:35:26 -	1.33
+++ concordance.c	18 Oct 2008 20:43:41 -
@@ -871,6 +871,7 @@ int detect_mode(uint8_t *data, uint32_t 
 {
 	int err, type;
 
+	*mode = MODE_UNSET;
 	err = identify_file(data, size, &type);
 	if (err) {
 		return err;
@@ -897,6 +898,35 @@ int detect_mode(uint8_t *data, uint32_t 
 	return 0;
 }
 
+char *mode_string(int mode)
+{
+	switch (mode) {
+	case MODE_CONNECTIVITY:
+		return "connectivity check";
+		break;
+	case MODE_WRITE_CONFIG:
+		return "write configuration";
+		break;
+	case MODE_WRITE_FIRMWARE:
+		return "write firmware";
+		break;
+	case MODE_LEARN_IR:
+		return "learn IR";
+		break;
+	default:
+		return "unknown";
+		break;
+	}
+}
+
+void report_mode_mismatch(int mode, int file_mode)
+{
+	printf("Error: Input file type recognized as: <%s>\n",
+		mode_string(file_mode));
+	printf("   does not match requested mode: <%s>\n",
+		mode_string(mode));
+}
+
 void help()
 {
 	printf("There are two ways to invoke this software. You can specify");
@@ -1076,7 +1106,7 @@ int main(int argc, char *argv[])
 {
 	struct options_t options;
 	char *file_name;
-	int mode, err;
+	int mode, file_mode, err;
 	uint8_t *data;
 	uint32_t size;
 
@@ -1128,23 +1158,34 @@ int main(int argc, char *argv[])
 			printf("Cannot read input file.\n");
 			exit(1);
 		}
+		/*
+		 * Now that the file is read, see if we can recognize it:
+		 */
+		if (detect_mode(data, size, &file_mode)) {
+			printf("Cannot determine mode of operation from"
+" file.\n");
+		}
+		/*
+		 * If we don't have a mode, lets detect that mode based on
+		 * the file.
+		 */
+		if (mode == MODE_UNSET) {
+			mode = file_mode;
+		} else {
+			if (mode != file_mode){
+report_mode_mismatch(mode, file_mode);
+exit(1);
+			}
+		}
 	}
 
 	/*
-	 * And if we don't have a mode, lets detect that mode based on
-	 * the file.
+	 * We have checked the parameters and the input file:
+	 * If we still don't know what to do, failure is the only option:
 	 */
-	if (mode == MODE_UNSET && file_name) {
-		if (file_name) {
-			if (detect_mode(data, size, &mode)) {
-printf("Cannot determine mode of operation from"
-	" file.\n");
-exit(1);
-			}
-		} else {
-			printf("No mode requested. No work to do.\n");
-			exit(1);
-		}
+	if (mode == MODE_UNSET) {
+		printf("No mode requested. No work to do.\n");
+		exit(1);
 	}
 
 	/*
@@ -1159,8 +1200,6 @@ int main(int argc, char *argv[])
 		populate_default_filename(mode, options.binary, &file_name);
 	}
 
-	err = 0;
-
 	err = init_concord();
 	if (err != 0) {
 		printf("Error initializing libconcord: %s\n",
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Failed with error 1

2008-10-17 Thread Stuart Doherty
A okay.  I get it now.  I didn't realize there were 2 stages to the
process:
-Download the connectivity file and run concordance on that to tell the
website the remote is there and ready
-The website gets told the remote is ready, and then sends the actual
update.  One more run of concordance on that file to update the remote.

...RTFM I guess, eh?  I didn't pick up on that.

Cool, I'm sorted out now.  Thanks a lot for this software.  If you can solve
the Blackberry Driver/Sync issue when you get a chance :) I can actually
even axe my virtualized WinXP!!

I will go file a bug as well.

Stu

On Thu, Oct 16, 2008 at 3:09 PM, Phil Dibowitz <[EMAIL PROTECTED]> wrote:

> On Wed, Oct 15, 2008 at 09:49:38PM -0400, Stuart Doherty wrote:
> > The command I use is:
> > sudo concordance -v -C Connectivity.EZHex
>
> That's a *connectivity* file, not a config file. Don't specify a mode
> (it'll
> figure it out) or use -t for connectivity test. Then you'll get a config.
>
> Can you file a bug and I'll add some better error handling code for this?
>
> --
> Phil Dibowitz [EMAIL PROTECTED]
> Open Source software and tech docsInsanity Palace of Metallica
> http://www.phildev.net/   http://www.ipom.com/
>
> "Never write it in C if you can do it in 'awk';
>  Never do it in 'awk' if 'sed' can handle it;
>  Never use 'sed' when 'tr' can do the job;
>  Never invoke 'tr' when 'cat' is sufficient;
>  Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkj3kW4ACgkQN5XoxaHnMrsYBgCgo2leA0PaAqJekBYe+GLaGp9Y
> 154An0PJjrhSw5MRz9SFQTzkcHxW5IK3
> =2KtR
> -END PGP SIGNATURE-
>
>


-- 

Stuart Doherty
920 Atlantic Boulevard
Waterloo, Ontario  N2K 4L4
home - (519) 746 4986
mobile - (519) 498 3265
[EMAIL PROTECTED]

"Lead, follow, or get out of the way"
-Thomas Paine
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Failed with error 1

2008-10-16 Thread Phil Dibowitz
On Wed, Oct 15, 2008 at 09:49:38PM -0400, Stuart Doherty wrote:
> The command I use is:
> sudo concordance -v -C Connectivity.EZHex

That's a *connectivity* file, not a config file. Don't specify a mode (it'll
figure it out) or use -t for connectivity test. Then you'll get a config.

Can you file a bug and I'll add some better error handling code for this?

-- 
Phil Dibowitz [EMAIL PROTECTED]
Open Source software and tech docsInsanity Palace of Metallica
http://www.phildev.net/   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming



signature.asc
Description: Digital signature
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Failed with error 1

2008-10-15 Thread Stuart Doherty
The command I use is:
sudo concordance -v -C Connectivity.EZHex

And the output is:
Concordance 0.20
Copyright 2007 Kevin Timmerman and Phil Dibowitz
This software is distributed under the GPLv3.

Requesting Identity: Error requesting identity
Failed with error 1

Thanks!

Stu

On Wed, Oct 15, 2008 at 9:42 PM, Stephen Warren <[EMAIL PROTECTED]>wrote:

> Stuart Doherty wrote:
> > Anyway, I seem to be hitting a roadblock.  I can dump a config, I can
> > re-write that config to the remote (Harmony 550), I can request the
> > identity using the -i switch, but for some reason I can't write a config
> > I downloaded from the harmony website.  I keep getting this message back:
> >
> > Concordance 0.20
> > Copyright 2007 Kevin Timmerman and Phil Dibowitz
> > This software is distributed under the GPLv3.
> >
> > Requesting Identity: 100% done
> > Failed with error 1
>
> What's the exact command you're running?
>
> Try adding the "-v" command-line option; it may give more information on
> the problem.
>



-- 

Stuart Doherty
920 Atlantic Boulevard
Waterloo, Ontario  N2K 4L4
home - (519) 746 4986
mobile - (519) 498 3265
[EMAIL PROTECTED]

"Lead, follow, or get out of the way"
-Thomas Paine
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Failed with error 1

2008-10-15 Thread Stephen Warren
Stuart Doherty wrote:
> Anyway, I seem to be hitting a roadblock.  I can dump a config, I can
> re-write that config to the remote (Harmony 550), I can request the
> identity using the -i switch, but for some reason I can't write a config
> I downloaded from the harmony website.  I keep getting this message back:
> 
> Concordance 0.20
> Copyright 2007 Kevin Timmerman and Phil Dibowitz
> This software is distributed under the GPLv3.
> 
> Requesting Identity: 100% done
> Failed with error 1

What's the exact command you're running?

Try adding the "-v" command-line option; it may give more information on
the problem.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


[concordance-devel] Failed with error 1

2008-10-15 Thread Stuart Doherty
I'm just trying Concordance for the first time.  Having Linux on my home
computer made finding a way to update my harmony a major PITA.  Thanks for
all the hardwork.

Anyway, I seem to be hitting a roadblock.  I can dump a config, I can
re-write that config to the remote (Harmony 550), I can request the identity
using the -i switch, but for some reason I can't write a config I downloaded
from the harmony website.  I keep getting this message back:

Concordance 0.20
Copyright 2007 Kevin Timmerman and Phil Dibowitz
This software is distributed under the GPLv3.

Requesting Identity: 100% done
Failed with error 1



Any ideas?  I took the remote to work today and was able to flash the config
on a Windows box no problem.  And I then dumped that config back here with
concordance, and re-wrote it to the remote, no problem.
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel