public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rogier Wolff <R.E.Wolff@BitWizard.nl>
To: Mark C <gen-lists@blueyonder.co.uk>
Cc: linux-usb-users <linux-usb-users@lists.sourceforge.net>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [Linux-usb-users] Re: Problems accessing USB Mass Storage
Date: Tue, 17 Sep 2002 23:58:22 +0200	[thread overview]
Message-ID: <20020917235822.C26741@bitwizard.nl> (raw)
In-Reply-To: <1032297193.1276.23.camel@stimpy.angelnet.internal>

On Tue, Sep 17, 2002 at 10:13:13PM +0100, Mark C wrote:
> On Tue, 2002-09-17 at 21:13, Thomas Dodd wrote:
> 
> > 
> > Give that a go Mark.
> > 
> > Try a few values like 25, 50, 75, and 100. with bs=1k and
> > unset (default 512 byte).
> 
> If I'm reading this correctly, I have been trying:
> 
> [root@stimpy mark]# dd if=/dev/sda of=tmp/tmp.img skip=50 \
> bs=1k                                                                                                         dd: reading `/dev/sda': Input/output error
> 0+0 records in
> 0+0 records out

Guys, 

When dd is told to skip a certain number of input blocks it doesn't
seek past them, but reads them and then discards them. Thus if you're
not supposed to read sectors 1-100 then this will not work. 

Try the following program: 


/* seek.c (C) R.E.Wolff@harddisk-recovery.nl */
/* 
	gcc -Wall -O2 seek.c -o seek 
*/

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>

#ifndef O_LARGEFILE
#define O_LARGEFILE     0100000
#endif
long long lseek64 (int fd, long long offset, int whence);


int main (int argc,char **argv)
{
  long long off;
  long long tt;

  if(argc < 2)
        exit(0);        /* don't seek at all */

  if (strncmp (argv[1],"0x",2) )
    sscanf (argv[1],"%Ld",&off);
  else
    sscanf (argv[1],"%Lx",&off);

  if (argc > 3) {
    if (strncmp (argv[3],"0x",2) )
      sscanf (argv[3],"%Ld",&tt);
    else
      sscanf (argv[3],"%Lx",&tt);
    if (argv[2][0] == '+')
      off += tt;
    else
      off -= tt;
  }
  
  errno = 0;
  if ((lseek64 (0,off,SEEK_CUR) < 0) &&
      (errno != 0))
    perror ("seek");
  exit (0);
}


with the command: 

	dd if=/dev/sda of=firstpart 

(Get the partition table)

	(seek 0x100000;dd of=secondpart) < /dev/sda 

Get everything beyond 1Mb. If this works, then we have to figure out
how low we can make the "0x100000" number to get all of the data.

Hypothesis: The partition table specifies that the data starts
on sector 200, and they didn't implement sectors 1-199.....
Cheap basterds. 

(My memory stick is just over 128 * 10^6 bytes, and not even
close to 128 * 2^20 bytes....)

			Roger. 

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* The Worlds Ecosystem is a stable system. Stable systems may experience *
* excursions from the stable situation. We are currenly in such an       * 
* excursion: The stable situation does not include humans. ***************

  parent reply	other threads:[~2002-09-17 21:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 18:15 Problems accessing USB Mass Storage Jonathan Corbet
2002-09-17 18:22 ` Randy.Dunlap
2002-09-17 19:46   ` Mark C
2002-09-17 20:12     ` jbradford
2002-09-17 21:21     ` Jonathan Corbet
2002-09-17 19:50   ` Thomas Dodd
2002-09-17 19:58     ` Matthew Dharm
2002-09-17 20:13       ` Thomas Dodd
2002-09-17 21:13         ` [Linux-usb-users] " Mark C
2002-09-17 21:40           ` Thomas Dodd
2002-09-17 21:51             ` Mark C
2002-09-17 21:58           ` Rogier Wolff [this message]
2002-09-17 22:17             ` Thomas Dodd
2002-09-17 22:23               ` Randy.Dunlap
2002-09-18  9:28         ` Andries Brouwer
2002-09-18  9:22 ` Andries Brouwer
  -- strict thread matches above, loose matches on Subject: below --
2002-09-17 22:04 Thomas Dodd
2002-09-17 22:12 ` [Linux-usb-users] " Randy.Dunlap
2002-09-17 22:51 Mark C
2002-09-17 23:09 ` [Linux-usb-users] " Randy.Dunlap
     [not found] <Pine.LNX.4.33L2.0209171627330.14033-100000@dragon.pdx.osdl.net>
2002-09-17 23:46 ` Mark C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020917235822.C26741@bitwizard.nl \
    --to=r.e.wolff@bitwizard.nl \
    --cc=gen-lists@blueyonder.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox