Skip to contentSkip to conversation

chdkptp cli

PATCH New Matthew Urry 2 participants 5 messages Dec 23, 2013 – Jun 11, 2014

lore
Share & tools
lore
#0 lore raw

cover chdkptp cli

This patch adds the chdkptp program to buildroot. This program is used to interact with Canon cameras over usb that have had their firmware hacked. It enables things like remote tethering via usb. I have only enabled the command line interface and not the GUI.

http://chdk.wikia.com/wiki/CHDK
https://www.assembla.com/spaces/chdkptp/wiki

Matthew Urry (1):
chdkptp CLI added

 package/Config.in                                  |    1 +
 package/chdkptp/Config.in                          |   15 +++++++++++
 .../chdkptp-01-add_lm_flag_to_makefile.patch       |   15 +++++++++++
 ...ptp-02-create_sh_script_to_launch_chdkptp.patch |   22 ++++++++++++++++
 package/chdkptp/chdkptp.mk                         |   27 ++++++++++++++++++++
 5 files changed, 80 insertions(+)
 create mode 100644 package/chdkptp/Config.in
 create mode 100644 package/chdkptp/chdkptp-01-add_lm_flag_to_makefile.patch
 create mode 100644 package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch
 create mode 100644 package/chdkptp/chdkptp.mk
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 chdkptp CLI added

---
 package/Config.in                                  |    1 +
 package/chdkptp/Config.in                          |   15 +++++++++++
 .../chdkptp-01-add_lm_flag_to_makefile.patch       |   15 +++++++++++
 ...ptp-02-create_sh_script_to_launch_chdkptp.patch |   22 ++++++++++++++++
 package/chdkptp/chdkptp.mk                         |   27 ++++++++++++++++++++
 5 files changed, 80 insertions(+)
 create mode 100644 package/chdkptp/Config.in
 create mode 100644 package/chdkptp/chdkptp-01-add_lm_flag_to_makefile.patch
 create mode 100644 package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch
 create mode 100644 package/chdkptp/chdkptp.mk
package/Config.in +1 -0
index 3685807..369d361 100644
@@ -259,6 +259,7 @@ endmenu
 source "package/a10disp/Config.in"
 source "package/acpid/Config.in"
 source "package/cdrkit/Config.in"
+source "package/chdkptp/Config.in"
 source "package/cryptsetup/Config.in"
 source "package/dbus/Config.in"
 source "package/dbus-glib/Config.in"
package/chdkptp/Config.in new file +15 -0
new file mode 100644
index 0000000..cfd2de9
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_CHDKPTP
+	bool "chdkptp"
+	select BR2_PACKAGE_LUA 
+	select BR2_PACKAGE_LIBUSB
+	select BR2_PACKAGE_LIBUSB_COMPAT
+	depends on BR2_LARGEFILE
+	depends on BR2_USE_WCHAR
+	help
+	  chdkptp is a client application for interacting with
+	  the chdk ptp extension. This will complie the CLI only.
+	  
+	  http://chdk.wikia.com/wiki/CHDK
+	  https://www.assembla.com/spaces/chdkptp/wiki
+comment "chdkptp needs a toolchain w/ largefile and wchar"
+	depends on (!BR2_LARGEFILE || !BR2_USE_WCHAR)
package/chdkptp/chdkptp-01-add_lm_flag_to_makefile.patch new file +15 -0
new file mode 100644
index 0000000..82aeedd
@@ -0,0 +1,15 @@
+Makefile: add -lm to linker flags
+
+Signed-off-by: Matthew Urry <[email protected]>
+
+diff -purN chdkptp-461.orig/Makefile chdkptp-461/Makefile
+--- chdkptp-461.orig/Makefile	2013-12-08 12:10:18.469855434 +0000
++++ chdkptp-461/Makefile	2013-12-08 12:11:16.164098345 +0000
+@@ -88,6 +88,7 @@ INC_PATHS+=-I$(CHDK_SRC_DIR)
+ CFLAGS+=$(INC_PATHS) -DCHDKPTP_BUILD_NUM=$(SVNREV) -DCHDKPTP_REL_DESC="\"alpha\""
+ 
+ LDFLAGS+=$(LIB_PATHS) $(patsubst %,-l%,$(LINK_LIBS) $(SYS_LIBS)) 
++LDFLAGS+=-lm
+ 
+ SUBDIRS=lfs
+ 
package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch new file +22 -0
new file mode 100644
index 0000000..aadd6c7
@@ -0,0 +1,22 @@
+diff -purN chdkptp/chdkptp-sample.sh chdkptp-patched/chdkptp-sample.sh
+--- chdkptp/chdkptp-sample.sh	2013-12-23 09:06:03.772637062 +0000
++++ chdkptp-patched/chdkptp-sample.sh	1970-01-01 01:00:00.000000000 +0100
+@@ -1,7 +0,0 @@
+-#!/bin/sh
+-# adjust the following to your configuration
+-CHDKPTP_DIR=/path/to/chdkptp
+-# only need if you have compiled IUP support and have NOT installed the libraries to system directories 
+-#export LD_LIBRARY_PATH=/path/to/iup:/path/to/cd
+-export LUA_PATH="$CHDKPTP_DIR/lua/?.lua"
+-"$CHDKPTP_DIR/chdkptp" "$@"
+diff -purN chdkptp/chdkptp.sh chdkptp-patched/chdkptp.sh
+--- chdkptp/chdkptp.sh	1970-01-01 01:00:00.000000000 +0100
++++ chdkptp-patched/chdkptp.sh	2013-12-23 09:08:51.868642764 +0000
+@@ -0,0 +1,7 @@
++#!/bin/sh
++# adjust the following to your configuration
++CHDKPTP_DIR=/usr/share/chdkptp
++# only need if you have compiled IUP support and have NOT installed the libraries to system directories 
++#export LD_LIBRARY_PATH=/path/to/iup:/path/to/cd
++export LUA_PATH="$CHDKPTP_DIR/lua/?.lua"
++"$CHDKPTP_DIR/chdkptp" "$@"
package/chdkptp/chdkptp.mk new file +27 -0
new file mode 100644
index 0000000..80b6a60
@@ -0,0 +1,27 @@
+################################################################################
+#
+# chdkptp
+#
+################################################################################
+
+CHDKPTP_VERSION = 461
+CHDKPTP_SITE = http://subversion.assembla.com/svn/chdkptp/trunk
+CHDKPTP_SITE_METHOD = svn
+CHDKPTP_DEPENDENCIES = libusb-compat lua
+CHDKPTP_LICENSE = GPLv2
+
+define CHDKPTP_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) 
+endef
+
+define CHDKPTP_INSTALL_TARGET_CMDS
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp/lua
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp/lua/extras
+    	$(INSTALL) -m 0755 $(@D)/chdkptp $(TARGET_DIR)/usr/share/chdkptp
+        $(INSTALL) -m 0755 $(@D)/lua/*.lua $(TARGET_DIR)/usr/share/chdkptp/lua
+        $(INSTALL) -m 0755 $(@D)/lua/extras/*.lua $(TARGET_DIR)/usr/share/chdkptp/lua/extras
+        $(INSTALL) -m 0755 $(@D)/chdkptp.sh $(TARGET_DIR)/usr/bin/chdkptp
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/1 chdkptp CLI added

Dear Matthew Urry,

Thanks for this contribution. Note that for a single patch, there is no real need to send a cover letter (i.e the mail title PATCH 0/1). The text of your cover letter could almost as is have been part of the commit log itself (with just "I have only enabled the command line interface and not the GUI." changed to something less personal like "The package only builds the command line interface and not the GUI").

Some more comments below.

package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch

Quoted 5 lines · Matthew Urry
package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch new file +0 -0
new file mode 100644
index 0000000..aadd6c7

There is no description for this patch. And it seems to only be renaming a file. Why is this needed? Why don't you do it in the package .mk file instead?

package/chdkptp/chdkptp.mk line 10

Quoted 13 lines
package/chdkptp/chdkptp.mk new file +10 -0
@@ -0,0 +1,27 @@
+################################################################################
+#
+# chdkptp
+#
+################################################################################
+
+CHDKPTP_VERSION = 461
+CHDKPTP_SITE = http://subversion.assembla.com/svn/chdkptp/trunk
+CHDKPTP_SITE_METHOD = svn
+CHDKPTP_DEPENDENCIES = libusb-compat lua

Is 'lua' really a build dependency? Or is it only a runtime dependency?

package/chdkptp/chdkptp.mk line 11

Quoted 1 line
package/chdkptp/chdkptp.mk new file +1 -0
+CHDKPTP_LICENSE = GPLv2

License seems to be GPLv2+.

package/chdkptp/chdkptp.mk line 14

Quoted 2 lines
package/chdkptp/chdkptp.mk new file +2 -0
+define CHDKPTP_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) 

We generally like to also pass CFLAGS and LDFLAGS here by doing:

	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)

though that might require changing a bit the project Makefile to use constructs like:

override CFLAGS += ...
override LDFLAGS += ...

Note that doing that would also allow to avoid the -lm patch altogether.

package/chdkptp/chdkptp.mk line 20

Quoted 6 lines
package/chdkptp/chdkptp.mk new file +6 -0
+endef
+
+define CHDKPTP_INSTALL_TARGET_CMDS
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp/lua
+        $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/chdkptp/lua/extras

I believe that last one is sufficient: $(INSTALL) automatically creates intermediate directories if needed.

package/chdkptp/chdkptp.mk line 24

Quoted 4 lines
package/chdkptp/chdkptp.mk new file +4 -0
+    	$(INSTALL) -m 0755 $(@D)/chdkptp $(TARGET_DIR)/usr/share/chdkptp
+        $(INSTALL) -m 0755 $(@D)/lua/*.lua $(TARGET_DIR)/usr/share/chdkptp/lua
+        $(INSTALL) -m 0755 $(@D)/lua/extras/*.lua $(TARGET_DIR)/usr/share/chdkptp/lua/extras
+        $(INSTALL) -m 0755 $(@D)/chdkptp.sh $(TARGET_DIR)/usr/bin/chdkptp

I haven't looked, but why is usr/bin/chdkptp a shell script, and the real binary installed in /usr/share/chdkptp ? Adding a comment above the install target commands macro explaining why it is needed would be useful.

Could you take into account these comments and submit an updated version? Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 chdkptp CLI added

In reply to Matthew Urry

Dear Matthew Urry,

Quoted 13 lines · Matthew Urry
---
 package/Config.in                                  |    1 +
 package/chdkptp/Config.in                          |   15 +++++++++++
 .../chdkptp-01-add_lm_flag_to_makefile.patch       |   15 +++++++++++
 ...ptp-02-create_sh_script_to_launch_chdkptp.patch |   22 ++++++++++++++++
 package/chdkptp/chdkptp.mk                         |   27 ++++++++++++++++++++
 5 files changed, 80 insertions(+)
 create mode 100644 package/chdkptp/Config.in
 create mode 100644 package/chdkptp/chdkptp-01-add_lm_flag_to_makefile.patch
 create mode 100644 package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch
 create mode 100644 package/chdkptp/chdkptp.mk

You received some review on this patch on December, 28th 2013, suggesting several improvements to make your patch acceptable upstream. Your contributions are definitely welcome, but if you want to get it accepted, it'd be nice if you could resend a new version that takes into account the comments that have been made.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 chdkptp CLI added

Hello Matthew,

Quoted 15 lines · Thomas Petazzoni
Quoted 13 lines · Matthew Urry
---
 package/Config.in                                  |    1 +
 package/chdkptp/Config.in                          |   15 +++++++++++
 .../chdkptp-01-add_lm_flag_to_makefile.patch       |   15 +++++++++++
 ...ptp-02-create_sh_script_to_launch_chdkptp.patch |   22 ++++++++++++++++
 package/chdkptp/chdkptp.mk                         |   27 ++++++++++++++++++++
 5 files changed, 80 insertions(+)
 create mode 100644 package/chdkptp/Config.in
 create mode 100644 package/chdkptp/chdkptp-01-add_lm_flag_to_makefile.patch
 create mode 100644 package/chdkptp/chdkptp-02-create_sh_script_to_launch_chdkptp.patch
 create mode 100644 package/chdkptp/chdkptp.mk
Quoted 5 lines

You received some review on this patch on December, 28th 2013, suggesting several improvements to make your patch acceptable upstream. Your contributions are definitely welcome, but if you want to get it accepted, it'd be nice if you could resend a new version that takes into account the comments that have been made.

Since you never came back to the Buildroot community with an updated patch after about 6 months, despite us giving some review comments, we will now mark the patch as Rejected.

Of course, if you're still interested in seeing this patch merged, do not hesitate to send a new iteration that takes into account the comments that were made.

See http://patchwork.ozlabs.org/patch/304744/ for the review discussion.

Thanks for your contribution!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com