ZM Patch for edimax models. (IC-1500 & IC-1520)

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
pbae
Posts: 6
Joined: Fri Aug 08, 2008 8:00 am
Location: Belgium
Contact:

Post by pbae » Sat Apr 25, 2009 10:09 pm

Hi,

I identified and solved the problem with mpeg stream on the edimax models. (IC-1500 & IC-1520)
It is now possible to receive stream in mjpeg

Code: Select all

source type: remote
remote hostname: admin:1234@ip.of.cam.era
remote host port: 80
remote host path: /snapshot.cgi
I'm getting ~20 fps at 640x480 resolution (even wireless) :) instead of ~4 fps when using /snapshot.jpg


The problem was the double quotes present within boundary definition sent by the camera.

I modified the source "zm_remote_camera_http.cpp" for both regexp and 'simple" matching to handle facultative double quotes.


Please let me know your prefered way to post the update.

Pascal Baerten
ZM 1.24.1 with 6 cameras: 2x edimax IC-1500,1x edimax IC1520, 2x linksys WVC54GC, 1x Veo PTZ,
X10 intallation with 8 pir.

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Sat Apr 25, 2009 11:47 pm

As a diff or patch file is preferred as is typical any where.
diff -uN file file.new > Reason.patch

so in your case something like below with the zm version that the patch is for.
diff -uN zm_remote_camera_http.cpp.orig zm_remote_camera_http.cpp > zm_remote_camera_http.cpp_ZM-1.24.1.patch

Just remember to disable HTML in the post so that it don't strip anything out.

pbae
Posts: 6
Joined: Fri Aug 08, 2008 8:00 am
Location: Belgium
Contact:

1.24.1 patch

Post by pbae » Sun Apr 26, 2009 8:46 am

here is the diff:
--- /tmp/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:12:26.000000000 +0200
+++ /usr/src/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:18:25.000000000 +0200
@@ -283,7 +283,7 @@
}

if ( !content_type_expr )
- content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=(.+?))?\r?\n", PCRE_CASELESS );
+ content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=\x22?(.+?)\x22?)?\r?\n", PCRE_CASELESS );
if ( content_type_expr->Match( header, header_len ) >= 2 )
{
content_type = content_type_expr->MatchString( 1 );
@@ -712,8 +712,10 @@
if ( strncasecmp( start_ptr, boundary_match, boundary_match_len ) == 0 )
{
start_ptr += boundary_match_len;
- start_ptr += strspn( start_ptr, "-" );
+ start_ptr += strspn( start_ptr, "-\x22" ); // modified to allow facultative double quote in boundary="myboundary" like on IC-1500 cameras
content_boundary_len = sprintf( content_boundary, "--%s", start_ptr );
+ content_boundary_len = strcspn( content_boundary, "\x22" );
+ content_boundary[content_boundary_len]='\0';
Debug( 3, "Got content boundary '%s'", content_boundary );
}
else
ZM 1.24.1 with 6 cameras: 2x edimax IC-1500,1x edimax IC1520, 2x linksys WVC54GC, 1x Veo PTZ,
X10 intallation with 8 pir.

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Sun Apr 26, 2009 11:27 am

I take from your sig that this is for version 1.24.1 :?:

pbae
Posts: 6
Joined: Fri Aug 08, 2008 8:00 am
Location: Belgium
Contact:

Post by pbae » Sun Apr 26, 2009 6:40 pm

yes indeed. it's from the latest checkout.

Pascal
ZM 1.24.1 with 6 cameras: 2x edimax IC-1500,1x edimax IC1520, 2x linksys WVC54GC, 1x Veo PTZ,
X10 intallation with 8 pir.

johnnytolengo
Posts: 184
Joined: Tue Oct 14, 2008 5:59 pm

IC–1520

Post by johnnytolengo » Sun Jul 12, 2009 7:41 pm

How can i do the change in ZM 1.23 ?

I want to make work a Edimax IC–1520.


Help please! :)


Thanks.

johnnytolengo
Posts: 184
Joined: Tue Oct 14, 2008 5:59 pm

Post by johnnytolengo » Tue Jul 14, 2009 2:11 pm

I got i work with this config:

firmware: v1.27

Code: Select all

source type: remote
remote hostname: admin:1234@ip.of.cam.era
remote host port: 80
remote host path: /snapshot.jpg
running really nice.

Why did you use "/snapshot.cgi " ?

What is the diference between them (/snapshot.cgi and /snapshot.jpg)?

pbae
Posts: 6
Joined: Fri Aug 08, 2008 8:00 am
Location: Belgium
Contact:

Post by pbae » Fri Sep 11, 2009 1:46 pm

hi johnnytolengo,

/snapshot.cgi provide streamed content mjpeg (~20 fps)
/snapshot.jpg provide still snapshots (~5 fps).

However, to recognize the mjpeg stream, the patch proposed need to be applied and recompile.

Pascal
ZM 1.24.1 with 6 cameras: 2x edimax IC-1500,1x edimax IC1520, 2x linksys WVC54GC, 1x Veo PTZ,
X10 intallation with 8 pir.

pbae
Posts: 6
Joined: Fri Aug 08, 2008 8:00 am
Location: Belgium
Contact:

Post by pbae » Fri Sep 11, 2009 2:19 pm

in response to several PM on how to apply the patch:

copy and paste the content below in an editor and save it as patch.txt
--- /tmp/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:12:26.000000000 +0200
+++ /usr/src/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:18:25.000000000 +0200
@@ -283,7 +283,7 @@
}

if ( !content_type_expr )
- content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=(.+?))?\r?\n", PCRE_CASELESS );
+ content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=\x22?(.+?)\x22?)?\r?\n", PCRE_CASELESS );
if ( content_type_expr->Match( header, header_len ) >= 2 )
{
content_type = content_type_expr->MatchString( 1 );
@@ -712,8 +712,10 @@
if ( strncasecmp( start_ptr, boundary_match, boundary_match_len ) == 0 )
{
start_ptr += boundary_match_len;
- start_ptr += strspn( start_ptr, "-" );
+ start_ptr += strspn( start_ptr, "-\x22" ); // modified to allow facultative double quote in boundary="myboundary" like on IC-1500 cameras
content_boundary_len = sprintf( content_boundary, "--%s", start_ptr );
+ content_boundary_len = strcspn( content_boundary, "\x22" );
+ content_boundary[content_boundary_len]='\0';
Debug( 3, "Got content boundary '%s'", content_boundary );
}
else
then from the shell, execute the command:

Code: Select all

patch /usr/src/zm/src/zm_remote_camera_http.cpp patch.txt
of course, please adapt the path to met your installation.

once patch applied, recompile (make) and install the new build.


cordel, do you plan to include this patch in next release?

thanks

Pascal
ZM 1.24.1 with 6 cameras: 2x edimax IC-1500,1x edimax IC1520, 2x linksys WVC54GC, 1x Veo PTZ,
X10 intallation with 8 pir.

johnnytolengo
Posts: 184
Joined: Tue Oct 14, 2008 5:59 pm

Post by johnnytolengo » Fri Sep 11, 2009 6:23 pm

Ohhhhhhh thank you VERY MUCH!

It will be really usefull for me.

Tolengo

freechelmi
Posts: 3
Joined: Tue May 05, 2009 12:36 pm

Post by freechelmi » Tue Sep 22, 2009 8:29 am

Hi .

I contacted the edimax supported and they just answered me with another URL :


http://ip-address/mjpg/video.mjpg for IC1500 at least.

Do you confirm ? What perfs can be done with this URL ?

freechelmi
Posts: 3
Joined: Tue May 05, 2009 12:36 pm

Post by freechelmi » Tue Sep 22, 2009 8:34 am

BTW I just saw that Edimax published all the CGI commands and URL in July :


http://www.edimax.com/images/Image/CGI/ ... mmands.zip

That's a really good manufacturer then !

roundhay
Posts: 8
Joined: Thu Dec 04, 2008 7:16 pm

Post by roundhay » Tue Jan 19, 2010 10:43 pm

Does anyone know if this patch works with the IC-1510wg?

spychodelics
Posts: 14
Joined: Sun Jun 28, 2009 9:01 pm

Post by spychodelics » Wed Feb 24, 2010 12:13 pm

hi, i just got a ic-1500wg, running fine with snapshot.jpg at 5 fps but i dont get the cgi part working, is this implemented yet?

if changing to cgi zoneminder leaves the "video field" blank.

Im using the last Zoneminder-svn @ archlinux. 1.24.2

thanks for help

decibel83
Posts: 80
Joined: Tue Dec 06, 2005 5:22 pm

Post by decibel83 » Tue May 25, 2010 11:49 pm

pbae wrote:copy and paste the content below in an editor and save it as patch.txt
then from the shell, execute the command:

Code: Select all

patch /usr/src/zm/src/zm_remote_camera_http.cpp patch.txt
of course, please adapt the path to met your installation.
I pasted the code in patch.txt and ran the patch command, but I'm getting this error:

Code: Select all

venere:/usr/local/src/ZoneMinder-1.24.2# patch src/zm_remote_camera_http.cpp patch.txt
patching file src/zm_remote_camera_http.cpp
patch: **** malformed patch at line 4: }
Could you help me please?
Thank you very much!
Bye.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest