LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Mobile (https://www.linuxquestions.org/questions/linux-mobile-81/)
-   -   Samsung m510 "access beyond end" with 2GB card (https://www.linuxquestions.org/questions/linux-mobile-81/samsung-m510-access-beyond-end-with-2gb-card-688905/)

lyle_s 12-07-2008 09:55 AM

Samsung m510 "access beyond end" with 2GB card
 
When I connect my Samsung m510 with a 2 GB microSD card in it to the USB port and use the phone's menu to "Connect to PC", I get this in /var/log/messages:
Code:

Dec  6 22:15:00 bowman kernel: usb 2-5: new full speed USB device using ohci_hcd and address 3
Dec  6 22:15:00 bowman kernel: usb 2-5: configuration #1 chosen from 1 choice
Dec  6 22:15:00 bowman kernel: scsi7 : SCSI emulation for USB Mass Storage devices
Dec  6 22:15:05 bowman kernel: scsi 7:0:0:0: Direct-Access    Samsung  Mass Storage    2.31 PQ: 0 ANSI: 2
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: [sdb] 1985025 512-byte hardware sectors (1016 MB)
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: [sdb] Write Protect is off
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: [sdb] 1985025 512-byte hardware sectors (1016 MB)
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: [sdb] Write Protect is off
Dec  6 22:15:05 bowman kernel:  sdb: sdb1
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: [sdb] Attached SCSI removable disk
Dec  6 22:15:05 bowman kernel: sd 7:0:0:0: Attached scsi generic sg2 type 0
Dec  6 22:15:06 bowman kernel: attempt to access beyond end of device
Dec  6 22:15:06 bowman kernel: sdb: rw=0, want=3967354, limit=1985025
Dec  6 22:15:06 bowman kernel: attempt to access beyond end of device
Dec  6 22:15:06 bowman kernel: sdb: rw=0, want=3967355, limit=1985025
Dec  6 22:15:06 bowman kernel: attempt to access beyond end of device
Dec  6 22:15:06 bowman kernel: sdb: rw=0, want=3967356, limit=1985025

It works fine with a 1 GB microSD card.

df -h says the phone has 2 GB, but for some reason "sd" thinks it's only 1016 MB.

It makes the phone kind of go haywire. If I copy files to the phone they'll show up, but if I try to access them (for example use mplayer to play an mp3) the files aren't really there.

Is this a bug in the kernel? A bug in the phone? Is there a way I can force sd to think it's 2 GB.

Thanks,
Lyle.

Quakeboy02 12-07-2008 02:30 PM

Quote:

Is there a way I can force sd to think it's 2 GB.
Let me guess; you got this off of ebay, right? There are numerous articles about 1GB devices being remarked and hacked to show that they're 2GB or larger. The directory appears, but the data actually goes into a bit bucket.

lyle_s 12-07-2008 06:45 PM

Quote:

Originally Posted by Quakeboy02 (Post 3367386)
Let me guess; you got this off of ebay, right? There are numerous articles about 1GB devices being remarked and hacked to show that they're 2GB or larger. The directory appears, but the data actually goes into a bit bucket.

I bought it at a store. It's a SanDisk, but I had the same problem with a Verbatim. I don't think it's the card.

I think it's something to do with how the sd driver determines the size of the card, or how USB reports it, or the phone itself, or some combination thereof.

Lyle.

Quakeboy02 12-07-2008 07:54 PM

Quote:

Originally Posted by lyle_s (Post 3367550)
I bought it at a store. It's a SanDisk, but I had the same problem with a Verbatim. I don't think it's the card.

I think it's something to do with how the sd driver determines the size of the card, or how USB reports it, or the phone itself, or some combination thereof.

Lyle.

OK, maybe it's a compatibility problem, then. Good luck!

lyle_s 12-07-2008 11:58 PM

Quote:

Originally Posted by Quakeboy02 (Post 3367599)
OK, maybe it's a compatibility problem, then. Good luck!

I'll try it with Windows over the holidays (I don't have any Windows machines, but my parents do); maybe that will shed some light on things.

Thanks!

Lyle.

lyle_s 12-28-2008 11:13 PM

Quote:

Originally Posted by lyle_s (Post 3367720)
I'll try it with Windows over the holidays (I don't have any Windows machines, but my parents do); maybe that will shed some light on things.

It worked like a charm with Windows.

The Windows drivers in use were dated 2001, so I doubt it's one of those situations where Windows is working around bugs/non-standard behavior of the phone.

This is a problem with Linux; how should I proceed to get this fixed?

Lyle.

lyle_s 08-02-2010 07:11 PM

Still no improvement with Slackware 13.1 (kernel 2.6.33.4, libusb-1.0.6).

Here's more detail:

I'm looking at the microSD card I use in the phone. It says 2GB. I put it into the phone, turn it back on.

I press, "Connect to PC" on the phone's menu. I get the following in /var/log/messages:
Code:

Aug  2 17:07:06 bowman kernel: usb 2-5: new full speed USB device using ohci_hcd and address 9
Aug  2 17:07:07 bowman kernel: usb 2-5: New USB device found, idVendor=05c6, idProduct=1000
Aug  2 17:07:07 bowman kernel: usb 2-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug  2 17:07:07 bowman kernel: usb 2-5: Product: USB MMC Storage
Aug  2 17:07:07 bowman kernel: usb 2-5: Manufacturer: Qualcomm, Incorporated
Aug  2 17:07:07 bowman kernel: usb 2-5: SerialNumber: 000000000002
Aug  2 17:07:07 bowman kernel: scsi9 : usb-storage 2-5:1.0
Aug  2 17:07:12 bowman kernel: scsi 9:0:0:0: Direct-Access    Samsung  Mass Storage    2.31 PQ: 0 ANSI: 2
Aug  2 17:07:12 bowman kernel: sd 9:0:0:0: Attached scsi generic sg4 type 0
Aug  2 17:07:12 bowman kernel: sd 9:0:0:0: [sdc] 1985025 512-byte logical blocks: (1.01 GB/969 MiB)
Aug  2 17:07:12 bowman kernel: sd 9:0:0:0: [sdc] Write Protect is off
Aug  2 17:07:12 bowman kernel:  sdc: sdc1
Aug  2 17:07:12 bowman kernel: sd 9:0:0:0: [sdc] Attached SCSI removable disk
Aug  2 17:07:13 bowman hald: mounted /dev/sdc1 on behalf of uid 1000

The above shows it's only 1GB.
Code:

lyle@bowman:/tmp$ df | egrep 'sdc|File'
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/sdc1              1983360  1291744    691616  66% /media/disk

# The above shows it to be 2GB.
Code:

lyle@bowman:/tmp$ echo '1024 * 691616' | bc
708214784

So, according to df, it has 708214784 bytes free.

Here's a file that should fit on the device.
Code:

lyle@bowman:/tmp$ ls -l should_fit
-rw------- 1 lyle lyle 690000000 2010-08-02 17:22 should_fit

So, I copy it on.
Code:

lyle@bowman:/tmp$ cp should_fit /media/disk/
lyle@bowman:/tmp$ echo $?
0

It copied successfully, although I get reams of messages of the form:
Code:

        Aug  2 17:27:55 bowman kernel: attempt to access beyond end of device
        Aug  2 17:27:55 bowman kernel: sdc1: rw=1, want=3925911, limit=1984776

in /var/log/messages. But cp did exit without error.

It appears to be there; the device in nearly full as seen below. The phone's UI agrees.
Code:

lyle@bowman:/tmp$ df | egrep 'sdc|File'
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/sdc1              1983360  1965600    17760 100% /media/disk

I'll attempt to copy it back off:
Code:

lyle@bowman:/tmp$ cp /media/disk/should_fit should_fit.copy
cp: reading `/media/disk/should_fit': Input/output error

So, it didn't read it back off.
Code:

lyle@bowman:/tmp$ ls -l should_fit.copy
-rwx------ 1 lyle lyle 36962304 2010-08-02 17:46 should_fit.copy*

So, I get some of it back, but not all. I also get a few more 'attempt to access beyond end of device' in /var/log/messages.

This all works properly with Windows. It fails the same way on another Slackware 13.1 box I have.

In conclusion:
  • There are two subsystems that aren't agreeing about the size of the device.
  • What are these two subsystems?
  • How does each of them determine the size of devices?

Thanks,
Lyle.


All times are GMT -5. The time now is 02:49 PM.