Misdetected volume size for Samsung YP-U1?

David Zeuthen david at fubar.dk
Wed Mar 22 13:42:08 PST 2006


On Wed, 2006-03-22 at 18:36 +0200, Weinehall David (Nokia-M/Tampere)
wrote:
> My Samsung YP-U1 (1GB flashbased OGG-player) gets reported
> as a "3.9GB Removable Volume" on the desktop by Nautilus.

Yea, your device reports the wrong block size:

>   volume.size = 1047814144  (0x3e746000)  (uint64)
>   volume.num_blocks = 2046512  (0x1f3a30)  (int)
>   volume.block_size = 2048  (0x800)  (int)

and the function libhal_volume_get_size() in libhal-storage uses
volume.num_blocks * volume.block_size instead of volume.size (because we
added the latter later).

Normally (always?), blocks are 512 bytes for USB storage devices but for
other storage thingies (notably optical discs) it can be slightly
larger; we use the BLKSSZGET ioctl to determine it.. Can you confirm
this with a short program that does this

  int fd;
  int block_size;

  fd = open ("/dev/sda1", O_RDONLY);
  ioctl (fd, BLKSSZGET, &block_size);
  printf ("block_size = %d", block_size);

and prints out the block_size? So, if this is the case it looks like the
usb-storage driver is buggy and you need a fix for your device in
unusual_devs.h or whatever it's called nowadays. Please report this to
the usb-storage maintainer if it's the case.

Thanks,
David




More information about the hal mailing list