Click here to go to the forum index Click here for the home page
 
Author Message

<  Computer connections  ~  ftpd-topfield 0.7.7n

Page 2 of 4
Goto page Previous  1, 2, 3, 4  Next
mstombs
Posted: Thu Dec 23, 2010 2:49 am Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 938
I can now compile 0.7.7 and it works, but not when compiled with LIBUSB. There is no error message, just reports via ftp that "unable to connect to toppy" - and it crashes the toppy end - need to power cycle toppy to recover.

I strongly suspect the BIG ENDIAN nslu2 libusb is broken, just surprised no-one has noticed before! OpenWRT use a Debian patch on usb.h to add " __attribute__ ((packed));" which apparently makes sure the library and what is linked against it understand the byte order.

Note that they have recently patched the later libusb-1.0 for a very similar problem
http://libusb.6.n5.nabble.com/libusb-51-Descriptor-endian-parsing-is-backwards-on-big-endian-hosts-td2652553.html

_________________
TF5800 1.5TB, TS On, NSLU2 + unslung 6.10 + WD500GB + MWI 0.66, F/W: MS6 Recommended F/W 12/9/2009 -Fm+AfBmC0CfCtFsIMPePfPsScUWfWs
TAPs: EPG2MEI v0.96; QuickJump 1.72; SecCache (UK) v0.4; (MyInfo B5.6); MHEG On/Off A3; Extend v1.7; MyStuff 6.6; DumbWidescreenTV 2.44; TF5000 Display v1.53; PruneEPG 1.0; (EIT Sub v0.6 SnG);
Sig generated with help from MyInfo on 18/4/15
?
View user's profile Send private message TF5800
richie
Posted: Thu Dec 23, 2010 9:05 am Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
birdman wrote:
richie wrote:
No it doesn't, but his puppy compile does.

wget http://birdman.dynalias.org/R2-D2/mips/ftpd
That's ftpd-topfield, not puppy.


Yes I know, sorry my post wasn't clear. Your puppy build works, but your fdtpd-topfield doesn't for me on my wl500gx 9.2-10 firmware, and the rest of my post was then a series of screen snippets - including where I got ftpd from - showing my problem.

I am using the very latest libusb in ipkg. I had to "ipkg install libusb" because without it, there was no .so file to pick up.

The bytes for the first CANCEL command between yours and the non ".n" version look identical, things go wrong when it calls usb_bulk_write (returns 0 - ok) and then usb_bulk_read, where it returns negative - it cannot get the response.

I have one toppy in a usb port on the asus, and on the other I have a (powered) usb hub with my memory stick and the second toppy.
View user's profile Send private message
richie
Posted: Thu Dec 23, 2010 9:56 am Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
Hi Birdman are you able to "ipkg -list_installed" on you wl500gx so I can crosscheck against my own non-working setup?
View user's profile Send private message
richie
Posted: Thu Dec 23, 2010 8:54 pm Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
Well for me it is nothing to do with Birdman's patch; the version of ftpdtopfield that his patch is applied to also fails to work if USE_LIBUSB is set to 1.

Strange that it works on one Asus gx and not another when both use same firmware and same libusb.

I've now got Birdman's wonderful patch working by hacking the libtopfield sourcecode to use the previous version of usb_bulk_read/write bundled with ftpdtopfield, but to use libusb for everything else. I do this by a nasty little hack to rename any reference to usb_bulk_ to my_bulk_, and then ensure that the #ifdef in usb_io.h is removed to always assume LIBUSB and always define the other stuff in that file, but not include any other usb.h variants. Finally I add usb_io.o to the object list in libtopfield/Makefile when USE_LIBUSB is set.

Still don't know why it works on one asus but not another ... but don't mind now!

cd libtopfield
sed -e "s@usb_bulk@my_bulk@" -i usb_io.h
sed -e "s@usb_bulk@my_bulk@" -i usb_io.c
sed -e "s@usb_bulk@my_bulk@" -i tf_io.c
sed -e "s@usb_bulk@my_bulk@" -i tf_fwio.c
vi Makefile
change: OBJS += usbutil.o
to: OBJS += usbutil.o usb_io.o

vi usb_io.h so that it contains:
#ifndef _USB_IO_H
#define _USB_IO_H 1

#include <usb.h>
#include <sys/types.h>
#include <linux/types.h>
#include <linux/version.h>
#include <linux/usbdevice_fs.h>

struct usb_dev_handle {
int fd;
};

typedef struct usb_dev_handle usb_dev_handle;

ssize_t my_bulk_write(struct usb_dev_handle *dev, int ep, const __u8 * bytes, ssize_t length, int timeout);
ssize_t my_bulk_read(struct usb_dev_handle *dev, int ep, __u8 * bytes, ssize_t size, int timeout);

#endif /* _USB_IO_H */
View user's profile Send private message
mstombs
Posted: Thu Dec 23, 2010 11:03 pm Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 938
Well done, I've given up with the slug for a while - I may try OpenWRT again because it may be the old kernel unslung uses

Code:
# uname -a
Linux SLUG 2.4.22-xfs #1 Sat Dec 29 03:29:38 UTC 2007 armv5b GNU/Linux


One thing I noticed in the source code is that libusb uses 16kB buffer reads, where libtopfield for my kernel used 4kB.

_________________
TF5800 1.5TB, TS On, NSLU2 + unslung 6.10 + WD500GB + MWI 0.66, F/W: MS6 Recommended F/W 12/9/2009 -Fm+AfBmC0CfCtFsIMPePfPsScUWfWs
TAPs: EPG2MEI v0.96; QuickJump 1.72; SecCache (UK) v0.4; (MyInfo B5.6); MHEG On/Off A3; Extend v1.7; MyStuff 6.6; DumbWidescreenTV 2.44; TF5000 Display v1.53; PruneEPG 1.0; (EIT Sub v0.6 SnG);
Sig generated with help from MyInfo on 18/4/15
?
View user's profile Send private message TF5800
birdman
Posted: Fri Dec 24, 2010 2:57 am Reply with quote
Frequent contributor Joined: 13 Dec 2006 Posts: 1765 Location: Hitchin, HERTS Tx: Sandy Heath
richie wrote:
Well for me it is nothing to do with Birdman's patch; the version of ftpdtopfield that his patch is applied to also fails to work if USE_LIBUSB is set to 1.
An interesting statement, since my patch actually adds the USE_LIBUSB variable then setting it to any value when the patch isn't there has no meaning!
and also wrote:
I've now got Birdman's wonderful patch working by hacking the libtopfield sourcecode to use the previous version of usb_bulk_read/write bundled with ftpdtopfield, but to use libusb for everything else.
That is, however, far more interesting, as I didn't (intentionally) change anything to do with the actual reading from/writing to the Toppy - all I did was change the scan do look for the device in the first place.
So perhaps I need to make this change in the "standard" code to avoid any name clash (although it's difficult to see why there should be one, as the symbol loaded from each compiled object would take precedence over any dynamically loaded library).

_________________

Toppy: TF5800PVR/250 - Black, now 1TB WD10EURX
F/W: MS6 Recommended F/W 12/9/2009 -FmVrXp+BmC0CbFsIPsUUuWfZXl,
Loader: C5.14, Hardware: 1.01
TAPs: SecCache (UK) v0.4; EPG2MEI v0.96; FontManager 1.0d; QuickJump 1.71; MhegOnOff(Now1) A3; EIT Sub v0.6; MyStuff 6.6
USB connected: SheevaPlug with Debian wheezy
Sig mostly from MyInfo on 26/10/09
View user's profile Send private message
richie
Posted: Fri Dec 24, 2010 8:57 am Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
birdman wrote:
An interesting statement, since my patch actually adds the USE_LIBUSB variable then setting it to any value when the patch isn't there has no meaning!


Ah, well I took you at face value when you said the following ... : )
ftpd‑topfield‑0.7.7.tar.gz
The original ftpd‑topfield distribution to which the patch was applied

Looking more closely now that I know it is not the original ftpd-topfield, I can see that the patch may not be there, but the modified Makefile IS which means that setting USE_LIBUSB is far from meaningless as it means usb_io is no longer compiled and the compilation does indeed pickup libusb for usb_bulk_XXX, regardless of the presence of the patch or not:

ifdef USE_LIBUSB
...
OBJS += usbutil.o
else
OBJS += usb_io.o usb_io_util.o
endif


However I still don't know why the original code should work on yours and not on mine, as I believe we have the same setup for asus model, firmware, and libusb.

Perhaps there is no need to rename usb_bulk_XXX then, it's just that the usb_io currently #ifdefs out the user defined versions when USE_LIBUSB is set. C is not my background so I just went for the ugly "see if this works" hack than thinking about precedence of definitions and wondering whether it wouldn't work because of multiple definitions, or because it was not fixing the problem.
View user's profile Send private message
mstombs
Posted: Fri Dec 24, 2010 6:25 pm Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 938
? The 'original' source of ftpd-topfield, libtopfield and puppy do seem to have USE_LIBUSB

http://puppy.cvs.sourceforge.net/puppy/

_________________
TF5800 1.5TB, TS On, NSLU2 + unslung 6.10 + WD500GB + MWI 0.66, F/W: MS6 Recommended F/W 12/9/2009 -Fm+AfBmC0CfCtFsIMPePfPsScUWfWs
TAPs: EPG2MEI v0.96; QuickJump 1.72; SecCache (UK) v0.4; (MyInfo B5.6); MHEG On/Off A3; Extend v1.7; MyStuff 6.6; DumbWidescreenTV 2.44; TF5000 Display v1.53; PruneEPG 1.0; (EIT Sub v0.6 SnG);
Sig generated with help from MyInfo on 18/4/15
?
View user's profile Send private message TF5800
richie
Posted: Fri Dec 24, 2010 6:55 pm Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
mstombs wrote:
? The 'original' source of ftpd-topfield, libtopfield and puppy do seem to have USE_LIBUSB

http://puppy.cvs.sourceforge.net/puppy/


OK, so Birdman's link to the original ftpd-topfield was correct, but that original version DOES contain compilation functionality for USE_LIBUSB. To be clear, the original ftpd-topfield was broken, for me at least, before any 0.7.7n mods.

It seems that for me on my wl500gx and for you on the slug - but not for Birdman on his wl500gx - libusb and more specifically usb_bulk_XXX does not work correctly with ftpd-topfield. Puppy works for me, but puppy does not use usb_bulk_XXX, with or without USE_LIBUSB.

I think the slug and asus have different endian-ness so perhaps the problem is either not endian-related, or they are implementing some endian-correction wrongly (which goes along with the link you posted). They are not simply forgetting about endian correction. But why does it work on some versions of wl500gx?
View user's profile Send private message
mstombs
Posted: Fri Dec 24, 2010 9:21 pm Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 938
Endianism may be a red-Herring, I tried static builds against patched libusb and it made no improvement.
View user's profile Send private message TF5800
birdman
Posted: Sat Dec 25, 2010 2:18 am Reply with quote
Frequent contributor Joined: 13 Dec 2006 Posts: 1765 Location: Hitchin, HERTS Tx: Sandy Heath
richie wrote:
OK, so Birdman's link to the original ftpd-topfield was correct...
as opposed to his memory - which is obviously malfunctioning.
It was the OLD_DEV_SCAN and NEW_DEV_SCAN I added, and these interact with USE_LIBUSB.
Which explains why I wasn't au fait with the usb_io loading changes. Sorry for the confusion - it's a while since I've worked on this.
What is odd, though, is that you have the problem, whereas I've compiled and used it on an Asus (mips) a Plug (armv5), 64-bit Intel and a PowerPC Mac, and they all "just worked".

_________________

Toppy: TF5800PVR/250 - Black, now 1TB WD10EURX
F/W: MS6 Recommended F/W 12/9/2009 -FmVrXp+BmC0CbFsIPsUUuWfZXl,
Loader: C5.14, Hardware: 1.01
TAPs: SecCache (UK) v0.4; EPG2MEI v0.96; FontManager 1.0d; QuickJump 1.71; MhegOnOff(Now1) A3; EIT Sub v0.6; MyStuff 6.6
USB connected: SheevaPlug with Debian wheezy
Sig mostly from MyInfo on 26/10/09
View user's profile Send private message
richie
Posted: Sat Dec 25, 2010 1:29 pm Reply with quote
Frequent contributor Joined: 30 Mar 2005 Posts: 156 Location: Ash Vale (Hannington)
Well as the problem lies with the widely used ftpd-topfield for me, rather than the patch, I can't believe it's a big problem otherwise it would have been flagged up and fixed before now. So unless the slug can be fixed using the same method, it looks like something is a little quirky with my Asus, rather than ftpd-topfield being "on the edge".

Thank you for the patch anyway, it works a treat, nice to have both toppies with their separate remotes and separate ftp ports, saves me having to upgrade the hard drive as I can now use one with a too-weak-til-switchover tuner as an archiving box, and the other as my watch-and-throw box, with the asus doing all the archiving from one to the other for me!
View user's profile Send private message
procount
Posted: Wed Jan 12, 2011 11:42 pm Reply with quote
Joined: 24 Nov 2008 Posts: 11
mstombs wrote:
I can now compile 0.7.7 and it works, but not when compiled with LIBUSB. There is no error message, just reports via ftp that "unable to connect to toppy" - and it crashes the toppy end - need to power cycle toppy to recover.

I have exactly the same problem.
I am using puppy in a PHP script to backup new toppy recordings to a USB hard disk attached to my ASUS wl500gx. However, for whatever reason, puppy transfers sometime fail, so I end up with only half a recording.
I would like to make puppy a bit more resilient, as ftpd-topfield seems to be, so that it will retry in the event of errors, or maybe to resume the transfer from the point it last stopped (as FTP can do, but puppy can't start from an arbitary offset).
Hence I needed to be able to compile both Puppy and ftpd-topfield.
This is my first foray into Linux programming on the ASUS and I've managed to get the build env set up and the files compiled, but I'm not sure how much further I can't get if this version of ftpd-topfield doesn't work. Maybe I should go back to an earlier version of ftpd-topfield...

_________________
TF5800, 456 TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+PeVbWf
TAPs: EPG2MEI v0.96; Power Manager v2.1; Extend v1.7; SDS V1.3e; MyInfo B5.1; Font Manager 1.0d; TAP Commander 1.33; UK OZ Surfer v0.11a; MyStuff 6.3; ASUS WL-500Gx + 1TB WD disk
View user's profile Send private message
mstombs
Posted: Sat Jan 15, 2011 10:02 am Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 938
I didn't investigate further - was going to try with OpenWRT on a slug to see if simple change of kernel made a difference. The new version would have been nice to avoid swapping cables between 2 Toppies -but not essential.

If only one Toppy why not use ftp from php?
View user's profile Send private message TF5800
procount
Posted: Sat Jan 15, 2011 10:54 pm Reply with quote
Joined: 24 Nov 2008 Posts: 11
Well, yes, I suppose that is an option. As I only have 1 toppy I don't really need to incorporate the new scan method.
I subsequently tried to recompile libusb to see if that helped, but I suffered a segmentation fault when compiling, so I gave up.
I think my preferred plan is to modify puppy to append to a file that already exists, like ftp does. i think that would be a useful addition without requiring libusb etc.

_________________
TF5800, 456 TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+PeVbWf
TAPs: EPG2MEI v0.96; Power Manager v2.1; Extend v1.7; SDS V1.3e; MyInfo B5.1; Font Manager 1.0d; TAP Commander 1.33; UK OZ Surfer v0.11a; MyStuff 6.3; ASUS WL-500Gx + 1TB WD disk
View user's profile Send private message

Display posts from previous:  

All times are GMT + 1 Hour
Page 2 of 4
Goto page Previous  1, 2, 3, 4  Next

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum