181 Commits

Author SHA1 Message Date
Michel Machado
4b7d35951f f3brew: accept parameters from prompt 2015-09-02 10:43:36 -04:00
Michel Machado
bce2b9899b f3probe: --debug-block-order and --debug-keep-file
This patch just enables debugging mode when parameters
--debug-block-order and --debug-keep-file are used;
This is equivalent to automatically adding --debug.
It was an expected behavior that wasn't implemented.
2015-09-02 10:43:36 -04:00
Michel Machado
0121daf4af Edit a comment 2015-09-02 10:43:36 -04:00
Michel Machado
1114987783 Merge pull request #20 from davidknoll/install
Why not have a make install target?
2015-09-02 09:49:10 -04:00
David Knoll
bbdddb23c9 Why not have a make install target? 2015-09-02 00:15:42 +01:00
Michel Machado
64bb916977 Merge pull request #18 from brunetton/master
Renaming README to README.md to make Markdown used by Github
2015-08-25 14:24:52 -04:00
Bruno Duyé
ebccd66c5a Renaming README to README.md to make Markdown used by Github 2015-08-23 12:31:58 +02:00
Michel Machado
d47c05ed17 Merge pull request #17 from brammeleman/patch-1
Use f3read/write in the same directory as log-f3wr
2015-07-18 13:52:02 -04:00
brammeleman
6ff6c00f97 use f3read/write in the same directory as log-f3wr 2015-07-17 23:32:26 +02:00
Michel Machado
4d913c1442 f3probe: handle failures in usb_fd_from_block_dev()
Function usb_fd_from_block_dev() wasn't releasing resources
if any error happened.

Reported-by: Peter Skensved
2015-03-30 07:36:11 -04:00
Michel Machado
902db294ef f3probe: align buffers with devices' block sizes
This patch should address issue discussed here:
https://github.com/AltraMayor/f3/issues/13

Reported-by: Dingyuan Wang
2015-02-14 10:36:07 -05:00
Michel Machado
4f13815dfc f3probe: use physical block size
f3probe was using a kernel-recommended logical block size.
This patch allows f3probe to always find
the last good physical block of devices.

This patch also renames option --block-order to --debug-block-order
since f3probe detects the physical block size of devices.
2015-02-14 09:56:04 -05:00
Michel Machado
8ee3eaca71 f3fix: deal with sectors whose sizes are not 512B
See discussion on this issue here:
https://github.com/AltraMayor/f3/issues/13

Reported-by: Dingyuan Wang
2015-02-12 09:24:18 -05:00
Michel Machado
ea4b33e275 f3probe: fix segmentation fault during manual reset 2015-02-04 16:48:20 -05:00
Michel Machado
d74ef39bdd f3probe: rename a variable for readability 2015-02-04 16:37:46 -05:00
Michel Machado
c3db1edd7c f3probe: improve error handling during resets 2015-02-02 14:41:17 -05:00
Michel Machado
8001dfdadd f3probe: make read_all() return negative errors
bdev_read_block(), who calls read_all(), is
expected to return negative errors.
2015-02-02 13:31:00 -05:00
Michel Machado
ac2d89a0b9 f3probe: improve manual reset
This patch handles the edge case in wich
the drive changes its size after a reset.
2015-02-02 13:31:00 -05:00
Michel Machado
ca59ef530d f3probe: deal with USB devices that support multilple drives
During manual resets, the drive was being identified by
idVendor, idProduct, and serial, what is NOT enough when
the USB device combines two or more drives.
For example the card reader Kingston MobileLite G3
supports two memory cards at the same time.

Discussion on the fixed issue is available here:
https://github.com/AltraMayor/f3/issues/10

User @derekchal was the first to report this problem.
2015-02-01 16:59:02 -05:00
Michel Machado
85d15520d4 f3probe: fix manual reset when card is removed
When the memory card in a card reader is removed,
the device is kept, not removed like in the case
the reader itself is unplugged.

This patch handles the `change' events that are generated in
the card-removal case.
2015-02-01 15:56:43 -05:00
Michel Machado
172f19373a f3probe: drop `Last good sector:' from geometry
The field `Last good sector:' does not make sense
when the device is damaged, and
the geometry should be indepedent of the condition or
type of the drive.

The information is not lost because when the device "fixable",
f3fix is recommended with the correct parameter.
2015-01-31 20:42:25 -05:00
Michel Machado
b70b9ce914 f3probe: improve I/O error handling 2015-01-31 20:35:26 -05:00
Michel Machado
7c0306ca6f f3probe: avoid hanging before the second reset
f3probe was writing too many blocks between
the first and the second reset due to
a poor estimate of the writing and reseting times.
v5.0
2014-12-24 12:10:47 -03:00
Michel Machado
755fdc29ff Update folder where drives are mounted in README
At least Ubuntu has added the username after /media/.
2014-12-24 12:00:02 -03:00
Michel Machado
79f7e7a339 f3fix: report success to user 2014-12-24 11:52:10 -03:00
Michel Machado
21e26faa0f Add f3fix to this release 2014-12-24 11:11:26 -03:00
Michel Machado
05eff6e76c f3probe: suggest f3fix when the drive is fake 2014-12-24 11:10:21 -03:00
Michel Machado
6fbe096089 f3probe: report if the device changes its filename
Due to the resets, the device might move its filename.
For example, from `/dev/sdb' to `/dev/sdc'.
2014-12-24 10:54:44 -03:00
Michel Machado
7f37ff5efb f3probe: rename block device to disk device
f3probe really cares about disk devices.
2014-12-24 09:55:53 -03:00
Michel Machado
3f02ab9ac6 f3fix: add proper support to parameters 2014-12-24 09:54:01 -03:00
Michel Machado
5df999a767 f3fix: improve error handling 2014-12-24 08:06:11 -03:00
Michel Machado
423777ee6b f3fix: functional but not polished version 2014-12-23 13:25:16 -03:00
Michel Machado
8e25afa42b Add stub version of f3fix 2014-12-23 11:15:33 -03:00
Michel Machado
f8797d8b7c Minor fixes 2014-12-23 11:12:37 -03:00
Michel Machado
da939f2d7d f3probe: fix parameter --block-order
Parameter --block-order was forcing debug mode.
This directive is expected to work for both modes: debug and test.
2014-12-18 08:38:57 -03:00
Michel Machado
919451abb9 f3probe: improve messages to users 2014-12-18 08:34:17 -03:00
Michel Machado
263ea4f68e f3probe: reduce code of the manual reset
One doesn't have to wait for the remove event,
only for the add event.
2014-12-18 08:30:55 -03:00
Michel Machado
1caeff3205 Bump version to 5.0 2014-12-17 11:35:22 -05:00
Michel Machado
506730b83f f3probe: ignore return of udev_device_unref()
It is not predictable how udev library handles
its reference counters.
2014-12-17 11:15:15 -05:00
Michel Machado
95c3f8110d f3probe: use unit blocks instead of sectors
f3proble is block aware, so there's no reason to use sectors.
Moreover, thanks to the last-good-sector field,
sector numbers are no longer useful.
2014-12-17 11:15:15 -05:00
Michel Machado
d603f2e90a f3probe: rebrand --debug-block-order to --block-order
The new parameter allows users to test drives with
forced block sizes.

This parameter is only meant to help testing drives whose
*real* sizes are not multiples of their block sizes;
this should be rather rare!
2014-12-17 11:15:15 -05:00
Michel Machado
490bf780a3 f3probe: report last good sector of the drive
This information is useful to fix fake drives using fdisk, or
another partition tool.
2014-12-17 09:13:56 -05:00
Michel Machado
662fbf3db7 f3probe: add a message after the last reset
This message is supposed to help the user to avoid
removing the drive after the last reset.
After a sequence of manual resets, it's almost automatic to unplug
the drive and lose all the save blocks; I've done it myself.
2014-12-17 09:00:22 -05:00
Michel Machado
f7ff381eaf f3probe: make error message friendlier
when the user can't run f3probe as root, direct her to
f3write/f3read.
2014-12-17 08:46:19 -05:00
Michel Machado
dd6ebe6b99 f3probe: make sure that the block device is a disk
This patch makes f3probe test that the block device passed is
a disk, not a partition or something else.
If the block device is a partition,
the correct disk device is reported.

Example of this new protection in action:
$ sudo f3probe /dev/sdb1
[sudo] password for michel:
F3 probe 4.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

Device `/dev/sdb1' is a partition of disk device `/dev/sdb'.
You can run this program as follows:
f3probe /dev/sdb

Application cannot continue, finishing...
2014-12-17 08:37:18 -05:00
Michel Machado
783ef37213 f3probe: drop old manual reset
The code of the old manual reset couldn't handle the case of
the drive changing its filename, i.e. "/dev/sdb" becomes
"/dev/sdc" after the drive is unplugged and plugged back.

Not only this is a bug, in the rare case the user is
testing multiple drives at the same time, this would lead
to bad behavior.
2014-12-17 06:41:37 -05:00
Michel Machado
12b44e1068 f3probe: add semiautomatic reset method
This new reset method monitors the USB subsytem to know
when the drive was unplugged and when it was plugged back
to continue instead of waiting for a key to be pressed after
those actions.

The following URLs were very useful to implement this patch:

http://www.signal11.us/oss/udev/
http://www.freedesktop.org/software/systemd/libudev/
2014-12-17 06:32:30 -05:00
Michel Machado
3853dbc998 f3probe: map_block_to_usb_dev() avoids enumeration
Function map_block_to_usb_dev() was enumerating all USB devices and
comparing their properties to find the one we need.
The new code directly resolves the device from major and minor
number of the block device.
2014-12-16 13:30:45 -05:00
Michel Machado
fb8c784670 f3probe: make it more uniform to add reset methods 2014-12-16 12:01:52 -05:00
Michel Machado
f2ac688edd f3probe: issue friendly message when no access
This patch makes f3probe issue a friendly error message
when the user doesn't have access to the device to be tested.
2014-12-16 09:41:12 -05:00