[concordance-devel] Request for EZHex files

2008-04-01 Thread Stephen Warren
I'm writing some code to identify what to do with EZHex/EZUp files
downloaded from the Logitech website.

I just realized I've never seen a "learn IR" command file (I have
connectivity, config update, and firmware all working).

Does anyone have any "learn IR" files for various remotes they could
mail to me, or let me download?

Thanks.

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


[concordance-devel] API to identify file type

2008-04-01 Thread Stephen Warren
In congruity, I have some code to identify the action to take for a
specific EzHex/EZUp file, without relying on any facet of the filename.

I'm thinking about porting this to C for libconcord. I guess the API
would look like:

#define TYPE_CONNECTIVITY  0
#define TYPE_CONFIGURATION 1
#define TYPE_FIRMWARE  2
// returns some error if can't identify.
int identify_file(uint8_t *in, uint32_t size, uint32_t * type);

Now, the question is then: Where do we get in/size from? Right now,
libconcord has separate APIs to read files of different specific types.
It seems that (especially since they all simply call a common function
now) we should make the following changes:

1) Replace all read_*_from_file with a single API:

// no need for binmode param, since we just grab the whole content
// in all cases
int read_file(char *filename, uint8_t **out, uint32_t *size);

Or in the future, we could just get the pointer via mmap, and all other
APIs wouldn't care.

2) Update post_connect_test_success to accept in/size instead of
filename, so apps that have used read_file already don't read the file
twice.

3) Update concordance (in auto mode) to always use read_file, then call
identify_file, then do the appropriate thing with it.

Does this make sense?

If so, I'll probably first simply work on writing identify_file with the
API I described above, which should be pretty self-contained, then do
the other API changes separately after that, to avoid merge conflicts.

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Patch: vi "modelines" for all source files

2008-04-01 Thread Stephen Warren
Phil Dibowitz wrote:
> Stephen Warren wrote:
>> Attached is a patch that adds the following line to the end of all
>> *.cpp, *.c, *.h files.
>>
>> This might help keeping people like me with different vi defaults on-style!
> 
> Though I was going to follow a different convention and put them near the
> top along with an $Id$ line, ala:
>... 
> Feel free to resubmit, or just wait and I'll get it done in the next day or 
> so.

No problem; here it is.
Index: concordance/concordance.c
===
RCS file: /cvsroot/concordance/concordance/concordance/concordance.c,v
retrieving revision 1.18
diff -u -p -r1.18 concordance.c
--- concordance/concordance.c	1 Apr 2008 05:32:59 -	1.18
+++ concordance/concordance.c	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
@@ -995,4 +999,3 @@ cleanup:
 
 	return err;
 }
-
Index: consnoop/consnoop.cpp
===
RCS file: /cvsroot/concordance/concordance/consnoop/consnoop.cpp,v
retrieving revision 1.8
diff -u -p -r1.8 consnoop.cpp
--- consnoop/consnoop.cpp	9 Mar 2008 01:50:48 -	1.8
+++ consnoop/consnoop.cpp	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
Index: libconcord/binaryfile.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/binaryfile.cpp,v
retrieving revision 1.6
diff -u -p -r1.6 binaryfile.cpp
--- libconcord/binaryfile.cpp	26 Mar 2008 01:48:08 -	1.6
+++ libconcord/binaryfile.cpp	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
@@ -102,4 +106,3 @@ size_t binaryinfile::read(uint8_t *b, ui
 {
 	return fread(b, len, 1, m_f);
 }
-
Index: libconcord/binaryfile.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/binaryfile.h,v
retrieving revision 1.3
diff -u -p -r1.3 binaryfile.h
--- libconcord/binaryfile.h	3 Mar 2008 02:58:16 -	1.3
+++ libconcord/binaryfile.h	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
Index: libconcord/concordance.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/concordance.h,v
retrieving revision 1.8
diff -u -p -r1.8 concordance.h
--- libconcord/concordance.h	7 Mar 2008 21:25:06 -	1.8
+++ libconcord/concordance.h	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+
+$Id$
+
 Copyright 2007 Kevin Timmerman
 
 This program is free software; you can redistribute it and/or modify
Index: libconcord/hid.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/hid.h,v
retrieving revision 1.4
diff -u -p -r1.4 hid.h
--- libconcord/hid.h	3 Mar 2008 02:58:16 -	1.4
+++ libconcord/hid.h	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 3 of the License, or
Index: libconcord/libconcord.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.cpp,v
retrieving revision 1.21
diff -u -p -r1.21 libconcord.cpp
--- libconcord/libconcord.cpp	1 Apr 2008 08:10:13 -	1.21
+++ libconcord/libconcord.cpp	2 Apr 2008 03:35:09 -
@@ -1,4 +1,8 @@
 /*
+ *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
+ *
+ *  $Id$
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; 

Re: [concordance-devel] Patch: vi "modelines" for all source files

2008-04-01 Thread Phil Dibowitz
Stephen Warren wrote:
> Attached is a patch that adds the following line to the end of all
> *.cpp, *.c, *.h files.
> 
> This might help keeping people like me with different vi defaults on-style!

Ha!! That's so funny, I was *JUST* about to do the same thing! (Though I
still one day want to convert everything from tabs to spaces). I also want
to add an emacs line but those are so hard to formulate. Bleck.

Though I was going to follow a different convention and put them near the
top along with an $Id$ line, ala:

/*
 *  vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab:
 *
 *  $Id$
 *
 *  This program is free software; you can redistribute it and/or modify
 ...

The only reason it's at the bottom in the specs/* files is because in a
plain-text document, it has to be the first line, and you can't really stick
it in a comment...

Feel free to resubmit, or just wait and I'll get it done in the next day or so.

-- 
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: OpenPGP digital signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


[concordance-devel] Patch: vi "modelines" for all source files

2008-04-01 Thread Stephen Warren
Attached is a patch that adds the following line to the end of all
*.cpp, *.c, *.h files.

This might help keeping people like me with different vi defaults on-style!
Index: concordance/concordance.c
===
RCS file: /cvsroot/concordance/concordance/concordance/concordance.c,v
retrieving revision 1.18
diff -u -p -r1.18 concordance.c
--- concordance/concordance.c	1 Apr 2008 05:32:59 -	1.18
+++ concordance/concordance.c	2 Apr 2008 02:57:05 -
@@ -996,3 +996,4 @@ cleanup:
 	return err;
 }
 
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: consnoop/consnoop.cpp
===
RCS file: /cvsroot/concordance/concordance/consnoop/consnoop.cpp,v
retrieving revision 1.8
diff -u -p -r1.8 consnoop.cpp
--- consnoop/consnoop.cpp	9 Mar 2008 01:50:48 -	1.8
+++ consnoop/consnoop.cpp	2 Apr 2008 02:57:06 -
@@ -192,3 +192,5 @@ int main(int argc, char *argv[])
 	infile.close();
 	return 0;
 }
+
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/binaryfile.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/binaryfile.cpp,v
retrieving revision 1.6
diff -u -p -r1.6 binaryfile.cpp
--- libconcord/binaryfile.cpp	26 Mar 2008 01:48:08 -	1.6
+++ libconcord/binaryfile.cpp	2 Apr 2008 02:57:07 -
@@ -103,3 +103,4 @@ size_t binaryinfile::read(uint8_t *b, ui
 	return fread(b, len, 1, m_f);
 }
 
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/binaryfile.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/binaryfile.h,v
retrieving revision 1.3
diff -u -p -r1.3 binaryfile.h
--- libconcord/binaryfile.h	3 Mar 2008 02:58:16 -	1.3
+++ libconcord/binaryfile.h	2 Apr 2008 02:57:07 -
@@ -47,3 +47,5 @@ public:
 };
 
 #endif
+
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/concordance.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/concordance.h,v
retrieving revision 1.8
diff -u -p -r1.8 concordance.h
--- libconcord/concordance.h	7 Mar 2008 21:25:06 -	1.8
+++ libconcord/concordance.h	2 Apr 2008 02:57:07 -
@@ -42,3 +42,5 @@ struct options_t {
 void report_net_error(const char *msg);
 
 #endif // ifndef CONCORDANCE_H
+
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/hid.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/hid.h,v
retrieving revision 1.4
diff -u -p -r1.4 hid.h
--- libconcord/hid.h	3 Mar 2008 02:58:16 -	1.4
+++ libconcord/hid.h	2 Apr 2008 02:57:07 -
@@ -39,3 +39,5 @@ int HID_WriteReport(const uint8_t *data)
 int HID_ReadReport(uint8_t *data, unsigned int timeout=500);
 
 #endif
+
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/libconcord.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.cpp,v
retrieving revision 1.21
diff -u -p -r1.21 libconcord.cpp
--- libconcord/libconcord.cpp	1 Apr 2008 08:10:13 -	1.21
+++ libconcord/libconcord.cpp	2 Apr 2008 02:57:07 -
@@ -1170,3 +1170,4 @@ void report_net_error(const char *msg)
 #endif
 }
 
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/libconcord.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.h,v
retrieving revision 1.14
diff -u -p -r1.14 libconcord.h
--- libconcord/libconcord.h	31 Mar 2008 01:40:36 -	1.14
+++ libconcord/libconcord.h	2 Apr 2008 02:57:07 -
@@ -399,3 +399,4 @@ int learn_ir_commands(char *file_name, i
 
 #endif /* LIBCONCORD_H */
 
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/protocol.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/protocol.h,v
retrieving revision 1.6
diff -u -p -r1.6 protocol.h
--- libconcord/protocol.h	30 Mar 2008 10:01:46 -	1.6
+++ libconcord/protocol.h	2 Apr 2008 02:57:07 -
@@ -105,3 +105,4 @@
 
 #endif
 
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/protocol_z.h
===
RCS file: /cvsroot/concordance/concordance/libconcord/protocol_z.h,v
retrieving revision 1.2
diff -u -p -r1.2 protocol_z.h
--- libconcord/protocol_z.h	30 Mar 2008 10:01:46 -	1.2
+++ libconcord/protocol_z.h	2 Apr 2008 02:57:07 -
@@ -139,3 +139,5 @@
 #define STATUS_BAD_CHECKSUM 0x7F
 
 #endif
+
+/* vi: textwidth=78 tabstop=8 shiftwidth=8 noexpandtab: */
Index: libconcord/remote.cpp
===
RCS file: /cvs

Re: [concordance-devel] Build failure with latest CVS

2008-04-01 Thread Stephen Warren
On Tue, April 1, 2008 1:45 am, Phil Dibowitz wrote:
> Stephen Warren wrote:
>> Phil Dibowitz wrote:
>>> It's so weird I don't get the same behavior...
>>> [variadic macros error from gcc]
>>
>> Yes indeed.
>>
>> I installed a Debian sid chroot on my Fedora 8 system using the
>> debootstrap utility, and installed the gcc-4.3 and g++-4.3 packages
>> using aptitude (Debian seems crazy fast downloading/installing
>> packages!) And, I get the same issue as I do on Fedora:
>>
>> [EMAIL PROTECTED]:~/cvs_wa/concordance/concordance# gcc-4.3 --version
>> gcc-4.3 (Debian 4.3.0-2) 4.3.1 20080321 (prerelease)
>>
>> gcc-4.3 -DHAVE_CONFIG_H -I.-Wall -ansi -pedantic-errors
>> -I../libconcord -MT concordance-concordance.o -MD -MP -MF
>> .deps/concordance-concordance.Tpo -c -o concordance-concordance.o `test
>> -f 'concordance.c' || echo './'`concordance.c
>
> You get different compile options than I do:
>
> gcc-4.3 -DHAVE_CONFIG_H -I.-Wall -ansi -pedantic-errors -g -O2 -MT
> concordance-concordance.o -MD -MP -MF .deps/concordance-concordance.Tpo -c
> -o concordance-concordance.o `test -f 'concordance.c' || echo
> './'`concordance.c
>
> You have an extra -I../libconcord which is triggering the error, I don't
> have that.

Yes; that's it.

Here's why: gcc is being evil.

If I "make install" in libconcord, libconcord.h gets put into
/usr/local/include/libconcord.h, which is a system compiler path. Compiles
against this location work fine.

If I simply copy libconcord to *any* directory other than the standard
paths, and use "-I the_directory", then it's in a user-specified path.
Builds fail this way.

So, it looks like gcc has some bug/quirk/feature that certain errors (such
as the variadic macro error) are ignored for headers found in system
compiler paths. In fact, if I replace "-I dir" with "-isystem dir", then
the build works fine, no matter whether dir is /home/swarren/myinc,
../libconcord, etc.

I guess this is to allow gcc/glibc/... to use C99/whatever features in
headers no matter what standard option the user requested for their own
code.

This of course means that if I install libconcord into e.g.
/home/swarren/tmp, then I'll have the same problem. I guess I'll just have
to use -isystem to point concordance at libconcord all the time...

Sigh.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] "Patch" Python bindings for libconcord

2008-04-01 Thread Stephen Warren
On Tue, April 1, 2008 2:29 am, Phil Dibowitz wrote:
> Stephen Warren wrote:
>> Re: The license. I suppose since this file is essentially derived from
>> libconcord.h, it must be GPL 3? If so, are you OK with it being LGPL 3
>> instead of full GPL 3, to allow non-GPL applications to use it? Either
>> way, feel free to replace the license header as needed for you to commit
>> it.
>
> They wouldn't be able to use your bindings in anyway, because they'd be
> linking against libconcord which isn't LGPL3, it's GPL3. Releasing LGPL
> bindings to a GPL library doesn't really make sense.

Well, since I don't mind either way, and released that file as public
domain, when you do merge it, you're completely free to modify the license
header to be GPL3 to fit in with the rest of the code, as you see fit.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Suggestion for some cleanup in libconcord.cpp

2008-04-01 Thread Andreas Schulz
On Tuesday 01 April 2008, Phil Dibowitz wrote:
> Applied. I made a tweak and renamed read_from_file to be _read_from_file,
> but other than that, I applied it as-is.
>
> Though I think I may re-org that file a bit.

Feel free as you like - it's just my 2p to keep things going and
tidy (same for the bugfix). Sorry for the missing underscore -
since it's even illegal in the code I've been paid for the last
15 years, it never came to my mind to start an identifier like 
that (though I just had to learn the hard way yesterday with
_DEBUG)...

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] "Patch" Python bindings for libconcord

2008-04-01 Thread Phil Dibowitz
Stephen Warren wrote:
> Phil,
> 
> Attached is a file that exposes Python bindings for libconcord, up to
> date with the latest CVS, and (partially) tested using congruity.
> 
> I propose we place it into libconcord/bindings/python/libconcord.py.

There's where I'd planned to put bindings as well, though I'm going to hold
off on merging for the moment. I'm almost done with my perl bindings and
want to make sure after seeing two sets of bindings that I still want them
there.

> Re: The license. I suppose since this file is essentially derived from
> libconcord.h, it must be GPL 3? If so, are you OK with it being LGPL 3
> instead of full GPL 3, to allow non-GPL applications to use it? Either
> way, feel free to replace the license header as needed for you to commit it.

They wouldn't be able to use your bindings in anyway, because they'd be
linking against libconcord which isn't LGPL3, it's GPL3. Releasing LGPL
bindings to a GPL library doesn't really make sense.

In addition, since part of the goal of the license we chose (there were
quite a few discussions between Kevin and I on the phone) was to prevent
proprietary use of the code, I'd have to say I'd like to to be full GPL.

> Hopefully if the file is in the concordance repository, changes to
> libconcord.h will be reflected there too (or at least, I'll send you
> patches before header updates make it into an official release.)

Agreed 100%. Let me finish up the perl stuff and I'll get them both merged.
Thanks!

(BTW, I hate perl's XS. It's evil.)
-- 
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: OpenPGP digital signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Suggestion for some cleanup in libconcord.cpp

2008-04-01 Thread Phil Dibowitz
Andreas Schulz wrote:
> On Monday 31 March 2008, Phil Dibowitz wrote:
>> Now that Stephen's patch has been merged, did you want to re-submit your
>> patch against the latest CVS? In theory it should make your patch a bit
>> smaller...
> 
> Yup - piece of cake now, with all that \0 termination or not stuff gone.
> Makes some functions almost redundant.
> I compiled the patch and did a few tests with up- and downloading files
> from/to the remote that looked ok.

Applied. I made a tweak and renamed read_from_file to be _read_from_file,
but other than that, I applied it as-is.

Though I think I may re-org that file a bit.
-- 
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: OpenPGP digital signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Bug 1898492 - no one else affected, or just not interested?

2008-04-01 Thread Phil Dibowitz
Andreas Schulz wrote:
> no, you didn't - here it comes...

I tweaked it a bit (you'd been waiting so long on this patch, I figured I'd
just tweak it for you rather than have you re-submit) to make it more
consistent with the rest of the code - we just use rsp[68] instead of
stop_rsp - and since we had one already, I changed its scope slightly so we
could re-use it.

Applied, thanks.

-- 
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: OpenPGP digital signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Suggestion for some cleanup i n libconcord.cpp

2008-04-01 Thread Andreas Schulz
On Monday 31 March 2008, Phil Dibowitz wrote:
> Now that Stephen's patch has been merged, did you want to re-submit your
> patch against the latest CVS? In theory it should make your patch a bit
> smaller...

Yup - piece of cake now, with all that \0 termination or not stuff gone.
Makes some functions almost redundant.
I compiled the patch and did a few tests with up- and downloading files
from/to the remote that looked ok.
Added also debug output of the Harmony code string in learn_ir_code.
Maybe read_from_file should eventually even be moved to binaryfile?

Andreas
Index: libconcord/libconcord.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.cpp,v
retrieving revision 1.18
diff -u -3 -p -u -p -r1.18 libconcord.cpp
--- libconcord/libconcord.cpp	30 Mar 2008 23:59:48 -	1.18
+++ libconcord/libconcord.cpp	1 Apr 2008 07:43:06 -
@@ -320,6 +320,37 @@ void delete_blob(uint8_t *ptr)
 	delete[] ptr;
 }
 
+/*
+ * Common routine to read contents of file named *file_name into
+ * byte buffer **out. Get size from file and return out[size] 
+ * as read from file.
+ */
+
+int read_from_file(char *file_name, uint8_t **out, uint32_t *size)
+{
+	binaryinfile file;
+
+	if (file_name == NULL) {
+		debug("Empty file_name");
+		return LC_ERROR_OS_FILE;
+	}
+
+	if (file.open(file_name) != 0) {
+		debug("Failed to open %s", file_name);
+		return LC_ERROR_OS_FILE;
+	}
+
+	*size = file.getlength();
+	*out = new uint8_t[*size];
+	file.read(*out, *size);
+
+	if (file.close() != 0) {
+		debug("Failed to close %s\n", file_name);
+		return LC_ERROR_OS_FILE;
+	}
+	return 0;
+}
+
 
 /*
  * GENERAL REMOTE STUFF
@@ -444,26 +475,17 @@ int post_postconfig(uint8_t *data, uint3
 
 int post_connect_test_success(char *file_name)
 {
+	uint32_t size;
+	uint8_t *buf;
+	int err = 0;
 	/*
 	 * If we arrived, we can talk to the remote - so if it's
 	 * just a connectivity test, tell the site we succeeded
 	 */
-	binaryinfile file;
-	if (file.open(file_name) != 0) {
-		return LC_ERROR_OS_FILE;
-	}
-
-	const uint32_t size = file.getlength();
-	uint8_t * const buf = new uint8_t[size];
-	file.read(buf, size);
-
-	Post(buf, size, "POSTOPTIONS", ri, true);
-
-	if (file.close() != 0) {
-		return LC_ERROR_OS_FILE;
+	if ( (err = read_from_file(file_name, &buf, &size)) == 0 ) {
+		Post(buf, size, "POSTOPTIONS", ri, true);
 	}
-
-	return 0;
+	return err;
 }
 
 int get_time()
@@ -544,23 +566,7 @@ int write_config_to_remote(uint8_t *in, 
 
 int read_config_from_file(char *file_name, uint8_t **out, uint32_t *size)
 {
-	binaryinfile file;
-
-	if (file.open(file_name) != 0) {
-		debug("Failed to open %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	*size = file.getlength();
-	*out = new uint8_t[*size];
-	file.read(*out, *size);
-
-	if (file.close() != 0) {
-		debug("Failed to close %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	return 0;
+	return read_from_file(file_name, out, size);
 }
 
 int write_config_to_file(uint8_t *in, uint32_t size, char *file_name,
@@ -787,23 +793,7 @@ int write_safemode_to_file(uint8_t *in, 
 
 int read_safemode_from_file(char *file_name, uint8_t **out, uint32_t *size)
 {
-	binaryinfile file;
-
-	if (file.open(file_name) != 0) {
-		debug("Failed to open %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	*size = file.getlength();
-	*out = new uint8_t[*size];
-	file.read(*out, *size);
-
-	if (file.close() != 0) {
-		debug("Failed to close %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	return 0;
+	return read_from_file(file_name, out, size);
 }
 
 /*
@@ -1106,23 +1096,7 @@ int extract_firmware_binary(uint8_t *xml
 	
 int read_firmware_from_file(char *file_name, uint8_t **out, uint32_t *size, int binary)
 {
-	binaryinfile file;
-
-	if (file.open(file_name) != 0) {
-		debug("Failed to open %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	*size = file.getlength();
-	*out = new uint8_t[*size];
-	file.read(*out, *size);
-
-	if (file.close() != 0) {
-		debug("Failed to close %s", file_name);
-		return LC_ERROR_OS_FILE;
-	}
-
-	return 0;
+	return read_from_file(file_name, out, size);
 }
 
 /*
@@ -1133,15 +1107,11 @@ int learn_ir_commands(char *file_name, i
 	int err;
 
 	if (file_name) {
-		binaryinfile file;
-		if (file.open(file_name)) {
-			return LC_ERROR_OS_FILE;
-		}
-		uint32_t size = file.getlength();
-		uint8_t * const x = new uint8_t[size];
-		file.read(x, size);
-		if (file.close() != 0) {
-			return LC_ERROR_OS_FILE;
+		uint32_t size = 0;
+		uint8_t *x = NULL;
+		err = read_from_file(file_name, &x, &size);
+		if (err != 0) {
+			return err;
 		}
 
 		uint8_t *t = x;
@@ -1161,10 +1131,11 @@ int learn_ir_commands(char *file_name, i
 
 		string ls;
 		rmt->LearnIR(&ls);
-		//printf("%s\n",ls.c_str());
+		debug("Learned code: %s",ls.c_str());
 
-		if (post)
+		if (post) {
 			Post(x, size, "POSTOPTIONS", ri, true, &ls, &keyname);
+		}
 	} else {
 		rmt->LearnIR();
 	}

Re: [concordance-devel] Build failure with latest CVS

2008-04-01 Thread Phil Dibowitz
Stephen Warren wrote:
> Phil Dibowitz wrote:
>> It's so weird I don't get the same behavior...
>> [variadic macros error from gcc]
> 
> Yes indeed.
> 
> I installed a Debian sid chroot on my Fedora 8 system using the
> debootstrap utility, and installed the gcc-4.3 and g++-4.3 packages
> using aptitude (Debian seems crazy fast downloading/installing
> packages!) And, I get the same issue as I do on Fedora:
> 
> [EMAIL PROTECTED]:~/cvs_wa/concordance/concordance# gcc-4.3 --version
> gcc-4.3 (Debian 4.3.0-2) 4.3.1 20080321 (prerelease)
> 
> gcc-4.3 -DHAVE_CONFIG_H -I.-Wall -ansi -pedantic-errors
> -I../libconcord -MT concordance-concordance.o -MD -MP -MF
> .deps/concordance-concordance.Tpo -c -o concordance-concordance.o `test
> -f 'concordance.c' || echo './'`concordance.c

You get different compile options than I do:

gcc-4.3 -DHAVE_CONFIG_H -I.-Wall -ansi -pedantic-errors -g -O2 -MT
concordance-concordance.o -MD -MP -MF .deps/concordance-concordance.Tpo -c
-o concordance-concordance.o `test -f 'concordance.c' || echo './'`concordance.c

You have an extra -I../libconcord which is triggering the error, I don't
have that.

-- 
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: OpenPGP digital signature
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


Re: [concordance-devel] Bug 1898492 - no one else affected, or just not interested?

2008-04-01 Thread Andreas Schulz
On Monday 31 March 2008, Phil Dibowitz wrote:
> Phil Dibowitz wrote:
> > 1. It's generated against 0.13, but CVS has changed DRASTICALLY since
> > then - can you please re-gen against CVS, and also check our new
> > SubmittingPatches file for further details.
done (hopefully conforming the rules now - just left out all the local ?files 
from the cvs diff)

> > 3. Why do you comment out the 'else if (r == RESPONSE_DONE) {' ? While we
> > shouldn't get this in the middle of things, it's certainly bad if we do,
> > and a good reason to stop - I'd prefer we leave that check in.
OK - left it in

> > 4. Can you add braces to your outer iff statement for me?
done

> > If you could re-submit a patch (to the list, please), with the above
> > changes, I'd appreciate it. The idea behind the patch looks solid to me.
>
> Andreas,
>
> I never saw you re-submit this patch - did I miss it?

no, you didn't - here it comes...
Index: libconcord/remote.cpp
===
RCS file: /cvsroot/concordance/concordance/libconcord/remote.cpp,v
retrieving revision 1.26
diff -u -3 -p -u -p -r1.26 remote.cpp
--- libconcord/remote.cpp	30 Mar 2008 23:59:48 -	1.26
+++ libconcord/remote.cpp	1 Apr 2008 07:21:26 -
@@ -782,6 +782,15 @@ int CRemote::LearnIR(string *learn_strin
 	const static uint8_t stop_ir_learn[] = { 0x00, COMMAND_STOP_IRCAP };
 	HID_WriteReport(stop_ir_learn);
 
+	/* read returned RESPONSE_DONE, otherwise next command wil fail! */
+	uint8_t stop_rsp[68];
+	err = HID_ReadReport(stop_rsp);
+	if (err == 0) {
+		if ((stop_rsp[1] & COMMAND_MASK) != RESPONSE_DONE) {
+			err = 1;
+		}
+	}
+
 	/*
 	 * Encode our pulses into string
 	 */
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel