• Home
  • Help
  • Search
  • Login
  • Register
  Show Posts
Pages: [1]
1  General Category / General Discussion / Re: sendfile corrupts data from an USB harddrive on: November 22, 2010, 08:41:44 AM
To use the test case, compile it on the sheevaplug with gcc and run it redirecting stdin from a big file (between 512MB and 2GB)

gcc -o test-sendfile test-sendfile.c
./test-sendfile < /media/usbdrive/Fedora-14-i386-disc1.iso

Then from another computer in the wired local network, execute this command changing sheevaplug_ip with the IP address of the sheevaplug:

 nc sheevaplug_ip 1100 | md5sum

Then verify that the md5sum is the same that the original file.
2  General Category / General Discussion / sendfile corrupts data from an USB harddrive on: November 22, 2010, 08:31:30 AM
Hello,

I have a sheevaplug and I've found that several versions of linux kernel from cbxbiker (http://sheeva.with-linux.com/sheeva) corrupts data sent using sendfile from an USB harddrive:  One byte each 100MB (aprox) is modified.

I've found that both lighttpd and cherokee corrupts files when downloading them at high speed (> 10MBps), but works correctly at low speed (dsl, 100KBps). I've developed an small C program which reproduces the problem. I've checked several versions of linux (2.6.34 to 2.6.35.7) and all exhibits this bug.


Did anyone also reproduce this problem? Any clue about the bug source?

This night I will try to reproduce it using a ram disk to discard a USB driver bug and I will try to get an USB2 ethernet adaptor to try to discard the ethernet driver.

test-sendfile.c
Code:
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
  #include <sys/sendfile.h>

 
  int main(void)
  {
    struct sockaddr_in stSockAddr;
    int SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
    if(-1 == SocketFD)
    {
      perror("can not create socket");
      exit(EXIT_FAILURE);
    }
 
    memset(&stSockAddr, 0, sizeof stSockAddr);
 
    stSockAddr.sin_family = AF_INET;
    stSockAddr.sin_port = htons(1100);
    stSockAddr.sin_addr.s_addr = INADDR_ANY;
 
    if(-1 == bind(SocketFD,(struct sockaddr *)&stSockAddr, sizeof stSockAddr))
    {
      perror("error bind failed");
      close(SocketFD);
      exit(EXIT_FAILURE);
    }
 
    if(-1 == listen(SocketFD, 10))
    {
      perror("error listen failed");
      close(SocketFD);
      exit(EXIT_FAILURE);
    }
 
    for(;;)
    {
      off_t pos = 0;
      int ConnectFD = accept(SocketFD, NULL, NULL);
 
      if(0 > ConnectFD)
      {
        perror("error accept failed");
        close(SocketFD);
        exit(EXIT_FAILURE);
      }
 
printf("Sent a file of %d bytes\n", sendfile(ConnectFD, 0, &pos, 0x7FFFFFFF));
 
      shutdown(ConnectFD, SHUT_RDWR);
 
      close(ConnectFD);
    }
 
    close(SocketFD);
    return 0;
  }
3  Hardware and U-Boot firmware / Hardware / Re: Help building a serial cable for Guruplug on: May 27, 2010, 10:32:39 AM
I haven't received the GP unit. I'll post the results when available.
4  Hardware and U-Boot firmware / Hardware / Re: Help building a serial cable for Guruplug on: May 18, 2010, 03:27:08 AM
I've also found a way to make a cheap USB to 3.3V serial port using a (not original) Nokia CA-42 cable (2 in ebay)

http://buffalo.nas-central.org/index.php/Use_a_Nokia_Serial_Cable_on_an_ARM9_Linkstation
5  Hardware and U-Boot firmware / Hardware / Help building a serial cable for Guruplug on: May 18, 2010, 03:03:53 AM
I have an Asus WL500gx wireless router that has an 8 pin header with two 3.3V serial ports (TX0, RX0, TX1, RX1, GND, +3.3V, RST and NC). I'm planing to connect port 1 to the GuruPlug. GP serial port has GND, TX, RX and +3.3V.

Can I directly connect GND-GND, RX1-TX, TX1-RX? Is any other component needed to isolate the devices?

Thanks.
Pages: [1]