Paul, Progress! I actually have it working, although my current solution is a work around. Once I work out the interrupt read quirk and the core dump on exit, I think I will be ready to make it a port.
The clear_halt from libusb was not implemented on the BSD side, so I with a little digging I have that implemented - otherwise I had to unplug the adapter every time I restarted the program. The only down side is that the patch will be required for the owfs. The usb_interrupt_read function is irrelevant, since the ugen driver makes that decision based on the endpoint type. The bind to IPV6 issue required a simple change to the ServerAddr function in ow_net.c, from AF_UNSPEC to AF_INET. It would be neat to update the code to check for both and spawn two threads, but that's another project! ;-) Also, when I kill owhttpd, it core dumps. Any ideas on where to look for that issue? Since the read in getstatus is returning 32 bytes (or more if I give it a bigger buffer) of all repeating data, I put in a loop that would read it until I got something less than 32 bytes. This isn't perfect, as an error condition could cause this to break. But, until I figure out why reading EP1 is providing so much data, it's all I can do. I've added quite a few debug messages. The snibbit below is an example of what's happening. The DS9490_reset issues a command, and then calls getstatus to wait for the ready. The Count is the number of times through my read loop - this line is printed each time the Command or Ready to read bytes change. On the first loop my comparison values are set (from 0), but the first read always gets me the status from the prior command. This will happen on every getstatus call. The second item at Count 1 is the new command that was issued. In this case we had to loop twice to get a < 32 byte read the first time, and then it ran through the getstatus loop again and had to do 17 more reads. The longer the time between the command and the read, the more loops. If I turn on ugen USB debugging too aggressively, the added logging will cause enough delay that the loop will run until there is a crazy short read, which is at the end of the buffer. It seems like a lower level process is honoring the polling interval (10ms in alternative 3) and just going crazy filling the buff er, as opposed to waiting until I poll. After each getstatus there is either another command, or a close, which is probably why there is only one extra command buffered up once I catch up. Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_reset Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: readlen=0 Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: Count: 0 Command: 0->117, 0-> 8 Ready to read: 0-> 1 Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: Count: 1 Command: 117->75, 8-> 8 Ready to read: 1-> 0 Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: Loops/Return: 2/16 Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: Loops/Return: 17/16 Jul 21 13:25:09 bsdtest OWFS[47728]: DS9490_getstatus: readlen=0 Rob. On Thursday, July 20, 2006, at 02:47PM, Alfille, Paul H.,M.D. <[EMAIL PROTECTED]> wrote: >The other "interesting" thing is usb device names. They are assigned in OWFS as >bus->dirname/busfilename which gives the 1/4 type syntax. >Apparently in FreeBSD we get dev/usb0//dev/ugen0. Since we use the handle >internally, it probably doesn't matter except for aesthetics. > > Paul > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of rnilsson >Sent: Thursday, July 20, 2006 12:42 AM >To: [email protected] >Subject: Re: [Owfs-developers] FreeBSD 6.1 Troubles... > > >Paul, > >Ok, that didn't work (it would have been too easy! ;-) ). It fails in a >different place, and the TCP6 issue is still present. Here's what I did: > >Removed include of sys/file.h > > gcc -DHAVE_CONFIG_H -I. -I. -I../../../../src/include -I/usr/local/include >-I../include -fexceptions -Wall -W -Wundef -Wshadow -Wpointer-arith >-Wcast-qual -Wcast-align -Wstrict-prototypes -Wredundant-decls >-D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -g -O2 -D_THREAD_SAFE -pthread >-D_XOPEN_SOURCE=500 -MT ow_ds9097.lo -MD -MP -MF .deps/ow_ds9097.Tpo -c >ow_ds9097.c -fPIC -DPIC -o .libs/ow_ds9097.o >ow_ds9097.c: In function `DS9097_send_and_get': >ow_ds9097.c:219: error: syntax error before "readset" >ow_ds9097.c:234: warning: implicit declaration of function `FD_ZERO' >ow_ds9097.c:234: error: `readset' undeclared (first use in this function) >ow_ds9097.c:234: error: (Each undeclared identifier is reported only once >ow_ds9097.c:234: error: for each function it appears in.) >ow_ds9097.c:235: warning: implicit declaration of function `FD_SET' >ow_ds9097.c:238: warning: implicit declaration of function `select' >ow_ds9097.c:242: warning: implicit declaration of function `FD_ISSET' >*** Error code 1 > >Stop in /usr/home/robert/owfs-2.4p3/module/owlib/src/c. >*** Error code 1 > >Added in: #include <sys/select.h> > >/bin/sh ../../../../libtool --tag=CC --mode=link gcc -I../include >-I../../../owlib/src/include -L../../../owlib/src/c -fexceptions -Wall >-W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align >-Wstrict-prototypes -Wredundant-decls -D_FILE_OFFSET_BITS=64 -g -O2 >-D_THREAD_SAFE -pthread -D_XOPEN_SOURCE=500 -L/usr/local/lib -o owhttpd >owhttpd.o owhttpd_handler.o owhttpd_present.o owhttpd_write.o >owhttpd_read.o owhttpd_dir.o owhttpd_favicon.o -low -Wl,--rpath >-Wl,/opt/owfs/lib -lusb >mkdir .libs >gcc -I../include -I../../../owlib/src/include -fexceptions -Wall -W -Wundef >-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes >-Wredundant-decls -D_FILE_OFFSET_BITS=64 -g -O2 -D_THREAD_SAFE >-D_XOPEN_SOURCE=500 -o .libs/owhttpd owhttpd.o owhttpd_handler.o >owhttpd_present.o owhttpd_write.o owhttpd_read.o owhttpd_dir.o >owhttpd_favicon.o -Wl,--rpath -Wl,/opt/owfs/lib >-L/usr/home/robert/owfs-2.4p3/module/owlib/src/c -pthread -L/usr/local/lib >/usr/home/robert/owfs-2.4p3/module/owlib/src/c/.libs/libow.so >/usr/local/lib/libusb.so -Wl,--rpath -Wl,/opt/owfs/lib -Wl,--rpath >-Wl,/usr/local/lib >/usr/home/robert/owfs-2.4p3/module/owlib/src/c/.libs/libow.so: undefined >reference to `major' >*** Error code 1 > >Stop in /usr/home/robert/owfs-2.4p3/module/owhttpd/src/c. >*** Error code 1 > >Set __BSD_VISIBLE to 1 and it compiled. > >I remarked out the clearing enpoint from the code: > >/* if ( (ret = > usb_clear_halt(usb, DS2490_EP3) || > usb_clear_halt(usb, DS2490_EP2) || > usb_clear_halt(usb, DS2490_EP1) ) ) { > LEVEL_DEFAULT("DS9490_open: usb_clear_halt failed >ret=%d\n", ret); > } else */ if ( DS9490_setup_adapter(pn) || > >And now I get this: > >bsdtest# ./owhttpd -u -p 3001 -F --error_print 2 --error_level 4 > CALL: PARSENAME path=[] >CONNECT: Adapter found: /dev/usb0//dev/ugen0 >DEFAULT: Opened USB DS9490 adapter at /dev/usb0//dev/ugen0. > DATA: DS9490_getstatus: Status byte[0]: 2 > DATA: DS9490_getstatus(): short detected > DATA: DS9490_setup_adapter: getstatus failed ret=-1 >DEFAULT: Error setting up USB DS9490 adapter at /dev/usb0//dev/ugen0. > DATA: BUS_first: No data will be returned > DATA: DS9490_reset > DATA: BUS_first failed during connect [-1/-1] > >Here are the entries from /var/log/messages: > >Jul 19 22:09:47 bsdtest kernel: ugen0: vendor 0x04fa product 0x2490, rev >1.00/0.02, addr 2 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.1 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.2 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.3 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.1 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.2 >Jul 19 22:11:55 bsdtest kernel: All threads purged from ugen0.3 > >netstat output: > >%netstat -a >Active Internet connections (including servers) >Proto Recv-Q Send-Q Local Address Foreign Address (state) >tcp6 0 0 *.3001 *.* LISTEN >tcp4 0 0 10.0.1.146.ssh TippyMac.64941 >ESTABLISHED >tcp4 0 0 localhost.smtp *.* LISTEN >tcp4 0 0 *.ssh *.* LISTEN >tcp6 0 0 *.ssh *.* LISTEN >udp4 0 0 *.syslog *.* >udp6 0 0 *.syslog *.* >Active UNIX domain sockets > >Rob. >-- >View this message in context: >http://www.nabble.com/FreeBSD-6.1-Troubles...-tf1969732.html#a5408880 >Sent from the OWFS - Dev forum at Nabble.com. > > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >Owfs-developers mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/owfs-developers > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >Owfs-developers mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/owfs-developers > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
