From: Christian M. <chr...@ru...> - 2005-03-02 04:10:47
|
On Wed, 2005-03-02 at 02:47, Paul Alfille wrote: > On Thursday 24 February 2005 04:13 pm, Christian Magnusson wrote: > > Hi Paul, > > > > I still haven't got any new 1-wire adapter, but I got some > > samples of SHA iButton(DS1963S) and Multikey iButton(DS1991L) > > which have family ID 0x02 and 0x18. They are unsupported > > so far, but I will try to add support for them as soon as I can. > > Added support for the DS1993L to your code. (Family 1A) > The 'L looks mostly like a DS2423 but without touch counters and a slightly > differrent "tamper" code. > > > > > I have serious problem with multiple adapters (when starting > > owfs with one working adapter and one bad adapter). > > > > It hangs on my Coldfire board and I haven't been able to trace > > it down since it hangs the whole kernel during a pthread_create() > > in FS_dir_seek() and Dir2(). It works on WRT54G even if it's > > a much older kernel AND older uClibc... The big difference is that > > my Coldfire doesn't have any MMU... > > Any progress? I have made some minor changes to the embedded functions, and I can now use multiple output devices at least... As you can see in the debug-output below, there were some problems to use the parent's variables in the embedded funtions. I haven't been able to fix multiple input devices yet (hanging in ow_dir.c), not even if I move ALL used variables into a struct and call the embedded function with a pointer to it. The small patches I have added to the embedded functions doesn't mess up the code very much, so I'll check in some of the changes when I have given up on the multiple input devices on uClinux on my Coldfire board. /Christian /> owserver -d /dev/ttyS1 -d /dev/ttyS0 -p 3002 -p 3003 & [51] /> Arg: -p [3002] Arg: -p [3003] ServerAddr: [(null)] [3003] ServerListen: out->ai_ok = 0x2ef8d0 ServerAddr: [(null)] [3003] ServerListen: out->ai_ok = 0x2ef8d0 bind error -1 [Address already in use] ServerListen: out->ai_ok = 0x2ef910 bind error -1 [Address already in use] ServerListen: Socket problem errno=98 owserver.ow_exit() LibClose() owserver.ow_exit() closelog() owserver.ow_exit() exit() Original code in ow_net.c ------------------------- /* Embedded function */ void * ConnectionThread( void * v ) { struct connection_out * out2 = out ; pthread_t thread2 ; /* Doubly Embedded function */ void * AcceptThread( void * v2 ) { int acceptfd ; (void) v2 ; //printf("ACCEPT thread=%ld waiting\n",pthread_self()) ; acceptfd = accept( out2->fd, NULL, NULL ) ; //printf("ACCEPT thread=%ld accepted fd=%d\n",pthread_self(),acceptfd) ; ACCEPTUNLOCK(out2) //printf("ACCEPT thread=%ld unlocked\n",pthread_self()) ; RunAccepted( acceptfd ) ; return NULL ; } (void) v ; ToListen( out2 ) ; for(;;) { ACCEPTLOCK(out2) #ifdef __UCLIBC__ if ( pthread_create( &thread2, NULL, AcceptThread, NULL ) ) Exit(1) ; pthread_detach(thread2); #else if ( pthread_create( &thread2, &attr, AcceptThread, NULL ) ) Exit(1) ; #endif } ----------------------------------------- ow_net.c changed to this works... /* Embedded function */ void * ConnectionThread( void * v ) { struct connection_out * out2 = (struct connection_out *)v ; pthread_t thread2 ; /* Doubly Embedded function */ void * AcceptThread( void * v2 ) { int acceptfd ; struct connection_out *o2 = (struct connection_out *)v2; //printf("ACCEPT thread=%ld waiting\n",pthread_self()) ; acceptfd = accept( o2->fd, NULL, NULL ) ; //printf("ACCEPT thread=%ld accepted fd=%d\n",pthread_self(),accept\fd) ; ACCEPTUNLOCK(o2) //printf("ACCEPT thread=%ld unlocked\n",pthread_self()) ; RunAccepted( acceptfd ) ; pthread_exit((void *)0); } ToListen( out2 ) ; for(;;) { ACCEPTLOCK(out2) #ifdef __UCLIBC__ if ( pthread_create( &thread2, NULL, AcceptThread, (void *)out2 ) ) Exit(1) ; pthread_detach(thread2); #else if ( pthread_create( &thread2, &attr, AcceptThread, (void *)out2 ) ) Exit(1) ; #endif } |