OK, I have a Sony A616 (8Gb) and a Sony A739F (16Gb).  Both exhibit this
problem.

The problem and the fix are both described in the comments above.
However, there's been a bit of too-ing and fro-ing so I thought I would
just summarize and write down the EXACT sequence of commands required to
fix this bug under Hardy Heron 8.10.  Particularly, I'd clarify what
needs fixing and what doesn't.

# uname -a
Linux parker 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 
GNU/Linux

First up, the clarifications.  There is only one single line of code
which needs to be fixed.  In blockdev.c the call to get the number of
blocks must use the 64 bit function hal_util_set_uint64_from_file and
not the 32 bit version.  This is because the device is (presumably) a
character device, so 1 block = 1 byte.  The "gint" type (aka G_TYPE_INT)
is a (signed) integer which is -2G to + 2G.  So any Sony 4G or over will
blow the limit.

To be more clear.  There is nothing wrong at all with the util.c
function.  It correctly uses strtoul as it should, since it is returning
an unsigned integer.  Repeat.  The strtoul/strtoll changes suggested are
completely bogus.  Don't change the strtoul/strtoll code in util.c.  It
is working properly.  It is only blockdev.c which is at fault.

So, assuming that you have logged in as root (add sudo to every line if
not).  The following should work, assuming that you have the source
repositories enabled.  To do this, start up Adept Manager, choose
"Manage Repositories" and check that "Sources" is turned on.  Then you
can build the module as follows.

# apt-get build-dep hal
# apt-get install fakeroot
# apt-get source hal

# cd hal-0.5.11~rc2
# cp hald/util.c hald/util.c.orig
# cp hald/linux/blockdev.c hald/linux/blockdev.c.orig

# sed -i '1439s/_set_int_/_set_uint64_/' hald/linux/blockdev.c
# diff hald/linux/blockdev.c hald/linux/blockdev.c.orig

# dpkg-buildpackage -us -uc -rfakeroot
# cd ..
# dpkg -i hal_0.5.11~rc2-1ubuntu8.1_i386.deb

Note that the "sed" command targets the specific line number 1439 in the
file blockdev.c.  If you are using a different version of the hal source
(i.e. not 5.11 rc 2) then it is very possible that the line you need to
change is not number 1439.

In case you need to find the new line number, the old code is:

                if (!hal_util_set_int_from_file (d, "volume.num_blocks", 
sysfs_path_real, "size", 0)) {
                        HAL_INFO (("Ignoring hotplug event - cannot read 
'size'"));
                        goto error;
                }

The new code is:

                if (!hal_util_set_uint64_from_file (d, "volume.num_blocks", 
sysfs_path_real, "size", 0)) {
                        HAL_INFO (("Ignoring hotplug event - cannot read 
'size'"));
                        goto error;
                }

The final "dpkg -i" will install the new module and will restart the HAL
daemon.  You do not need to reboot your machine.  Simply plug in the
device and you should immediately see:

[619137.132740] usb 5-8: new high speed USB device using ehci_hcd and address 5
[619137.265725] usb 5-8: configuration #1 chosen from 1 choice
[619137.269593] scsi5 : SCSI emulation for USB Mass Storage devices
[619137.269861] usb-storage: device found at 5
[619137.269863] usb-storage: waiting for device to settle before scanning
[619142.265930] usb-storage: device scan complete
[619142.269815] scsi 5:0:0:0: Direct-Access     SONY     WALKMAN          1.10 
PQ: 0 ANSI: 0 CCS
[619144.285827] ready

Note that my 16G player shows only 15G available.  The back of the box
says "A portion of the memory is used for data management functions.
Actual available memory is aprox 14.6Gb (15,726,411,776 bytes).

# df -m
/dev/sdb1                14999       152     14848   2% /media/WALKMAN

-- 
2.6.24 reports invalid storage size in /sys [Sony Walkman NWZ-S618F doesn't 
mount in Hardy]
https://bugs.launchpad.net/bugs/209483
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to