This could happen because the address of the bus_master variable was pointing to a stack location of the initiating function. The problem is fixes by passing the value of bus_master as argument.
Signed-off-by: Wolfgang Grandegger <[email protected]> --- This fixes one problem. Now I'm facing another one with "owfs" when scanning for devices: Jan 1 04:07:11 qong OWFS[1100]: DEBUG: ow_search.c:BUS_first(32) Start of directory path=/ device=00 00 00 00 00 00 00 00 Jan 1 04:07:11 qong OWFS[1100]: DEBUG: ow_w1_send.c:W1_send_msg(107) Netlink send ----------------- Jan 1 04:07:11 qong kernel: w1_cn_callback ... Jan 1 04:07:11 qong kernel: w1_cn_callback: 01.000000000000.00: type=04, len=4. Jan 1 04:07:11 qong kernel: w1_cn_callback: master-id=1: type=04, len=4. Jan 1 04:07:11 qong kernel: w1_process_command_master: cmd=2 Jan 1 04:07:11 qong kernel: w1_process_search_command Jan 1 04:07:11 qong kernel: w1_send_slave Jan 1 04:07:11 qong last message repeated 2 times Jan 1 04:07:11 qong kernel: w1_cn_callback: err=0 cmd=2 Jan 1 04:07:11 qong kernel: w1_netlink_send_error Jan 1 04:07:11 qong kernel: w1_cn_callback: err=0 cmd=2 Jan 1 04:07:41 qong OWFS[1100]: DEBUG: ow_w1_select.c:W1PipeSelect_timeout(69) Select returned zero (timeout) Jan 1 04:07:41 qong OWFS[1100]: DEBUG: ow_search.c:BUS_next(80) return = -5 | 00 00 00 00 00 00 00 00 The W1PipeSelect_timeout() does not realize data which have obviously been sent by the kernel do the netlink interface. It works fine with owserver/owdir. Any idea what goes wrong? Wolfgang. module/owlib/src/c/ow_w1_addremove.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Index: owfs/module/owlib/src/c/ow_w1_addremove.c =================================================================== --- owfs.orig/module/owlib/src/c/ow_w1_addremove.c +++ owfs/module/owlib/src/c/ow_w1_addremove.c @@ -54,7 +54,7 @@ static struct connection_in *FindIn(cons static void * AddBus( void * v ) { - int bus_master = ((int *) v)[0] ; + int bus_master = (int) v ; char name[63] ; int sn_ret ; struct connection_in * in ; @@ -92,7 +92,7 @@ static void * AddBus( void * v ) void * RemoveBus( void * v ) { - int bus_master = ((int *) v)[0] ; + int bus_master = (int) v ; char name[63] ; int sn_ret ; struct connection_in * in ; @@ -128,7 +128,7 @@ void * RemoveBus( void * v ) void AddW1Bus( int bus_master ) { pthread_t thread; - int err = pthread_create(&thread, NULL, AddBus, &bus_master ); + int err = pthread_create(&thread, NULL, AddBus, bus_master ); if (err) { LEVEL_CONNECT("W1 bus add thread error %d.\n", err); } @@ -137,7 +137,7 @@ void AddW1Bus( int bus_master ) void RemoveW1Bus( int bus_master ) { pthread_t thread; - int err = pthread_create(&thread, NULL, RemoveBus, &bus_master ); + int err = pthread_create(&thread, NULL, RemoveBus, bus_master ); if (err) { LEVEL_CONNECT("W1 bus add thread error %d.\n", err); } @@ -147,12 +147,12 @@ void RemoveW1Bus( int bus_master ) void AddW1Bus( int bus_master ) { - AddBus( &bus_master) ; + AddBus( bus_master) ; } void RemoveW1Bus( int bus_master ) { - RemoveBus( &bus_master) ; + RemoveBus( bus_master) ; } #endif /* OW_MT */ ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
