Now also fixes serial ports.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1082 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
dad7aed4b2
commit
a38d4e5bfc
|
@ -41,7 +41,7 @@ zma_SOURCES = zma.cpp $(zm_SOURCES)
|
|||
zms_SOURCES = zms.cpp $(zm_SOURCES)
|
||||
zmu_SOURCES = zmu.cpp $(zm_SOURCES)
|
||||
zmf_SOURCES = zmf.cpp $(zm_SOURCES)
|
||||
zmfix_SOURCES = zmfix.cpp zm_debug.c zm_db.cpp zm.cpp
|
||||
zmfix_SOURCES = zmfix.cpp zm_config.cpp zm_debug.c zm_db.cpp zm.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
zm.h \
|
||||
|
|
|
@ -167,7 +167,7 @@ zma_SOURCES = zma.cpp $(zm_SOURCES)
|
|||
zms_SOURCES = zms.cpp $(zm_SOURCES)
|
||||
zmu_SOURCES = zmu.cpp $(zm_SOURCES)
|
||||
zmf_SOURCES = zmf.cpp $(zm_SOURCES)
|
||||
zmfix_SOURCES = zmfix.cpp zm_debug.c zm_db.cpp zm.cpp
|
||||
zmfix_SOURCES = zmfix.cpp zm_config.cpp zm_debug.c zm_db.cpp zm.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
zm.h \
|
||||
|
@ -225,8 +225,8 @@ zmf_OBJECTS = $(am_zmf_OBJECTS)
|
|||
zmf_LDADD = $(LDADD)
|
||||
zmf_DEPENDENCIES =
|
||||
zmf_LDFLAGS =
|
||||
am_zmfix_OBJECTS = zmfix.$(OBJEXT) zm_debug.$(OBJEXT) zm_db.$(OBJEXT) \
|
||||
zm.$(OBJEXT)
|
||||
am_zmfix_OBJECTS = zmfix.$(OBJEXT) zm_config.$(OBJEXT) \
|
||||
zm_debug.$(OBJEXT) zm_db.$(OBJEXT) zm.$(OBJEXT)
|
||||
zmfix_OBJECTS = $(am_zmfix_OBJECTS)
|
||||
zmfix_LDADD = $(LDADD)
|
||||
zmfix_DEPENDENCIES =
|
||||
|
|
|
@ -31,12 +31,8 @@
|
|||
#include "zm.h"
|
||||
#include "zm_db.h"
|
||||
|
||||
bool fixDevice( int device )
|
||||
bool fixDevice( const char *device_path )
|
||||
{
|
||||
char device_path[64];
|
||||
|
||||
snprintf( device_path, sizeof(device_path), "/dev/video%d", device );
|
||||
|
||||
struct stat stat_buf;
|
||||
|
||||
if ( stat( device_path, &stat_buf ) < 0 )
|
||||
|
@ -82,6 +78,15 @@ bool fixDevice( int device )
|
|||
return( true );
|
||||
}
|
||||
|
||||
bool fixVideoDevice( int device )
|
||||
{
|
||||
char device_path[64];
|
||||
|
||||
snprintf( device_path, sizeof(device_path), "/dev/video%d", device );
|
||||
|
||||
return( fixDevice( device_path ) );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
char dbg_name_string[16] = "zmfix";
|
||||
|
@ -94,7 +99,7 @@ int main( int argc, char *argv[] )
|
|||
// Do all devices we can find
|
||||
for ( int device = 0; device < 256; device++ )
|
||||
{
|
||||
if ( !fixDevice( device ) )
|
||||
if ( !fixVideoDevice( device ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -124,7 +129,7 @@ int main( int argc, char *argv[] )
|
|||
for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
|
||||
{
|
||||
int device = atoi(dbrow[0]);
|
||||
fixDevice( device );
|
||||
fixVideoDevice( device );
|
||||
}
|
||||
|
||||
if ( mysql_errno( &dbconn ) )
|
||||
|
@ -134,6 +139,16 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
// Yadda yadda
|
||||
mysql_free_result( result );
|
||||
|
||||
if ( (bool)config.Item( ZM_OPT_X10 ) )
|
||||
{
|
||||
const char *x10_port = (const char *)config.Item( ZM_X10_DEVICE );
|
||||
|
||||
if ( x10_port )
|
||||
{
|
||||
fixDevice( x10_port );
|
||||
}
|
||||
}
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue