public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 2/5] CAN device test command
Date: Sun, 1 Nov 2009 10:45:11 -0400	[thread overview]
Message-ID: <200911010945.12254.vapier@gentoo.org> (raw)
In-Reply-To: <1257075217-26623-3-git-send-email-wg@grandegger.com>

On Sunday 01 November 2009 06:33:34 Wolfgang Grandegger wrote:
> +	if (op == 's') {
> +	else if (op == 'i') {
> +	else if (op == 'r') {
> +	} else if (op == 'x') {
> +	} else {

your if style here is inconsistent, but ignoring that, shouldnt this really be 
a switch() ?  although, by only checking the first char, you allow people to 
encode typos into their commands and not realize it until some point in the 
future where things get stricter.  i.e. people can do `can ilovecandy ...`

> +		unsigned int dev_num = 0, ibaud = 0;
> +		struct can_dev *dev;
> +
> +		if (argc > 2)
> +			dev_num = simple_strtoul (argv[2], NULL, 10);
> +		if (argc > 3) {
> +			ibaud = simple_strtoul (argv[3], NULL, 10);
> +			if (ibaud > 2)
> +				ibaud = 2;
> +		}
> +		dev = can_init (dev_num, ibaud);
> +		if (!dev)
> +			return 1;
> +		can_dev = dev;

if i told CAN to init an unknown device, i would expect to get an error and 
the command state to remain in said error state until i selected a proper CAN 
device.  otherwise, a script that didnt check the can init status would 
incorrectly operate on the previously selected can device.

how do other commands work ?  am i complaining about common convention here ?

> +		printf ("Usage:\n%s\n", cmdtp->usage);

cmd_usage() ?

> +	can, 3,	1, do_can,
> +	"can - CAN bus commands\n",
> +	"can status [level]\n"
> +	"can init [dev] [baud-index]\n"
> +	"can xmit [id] [d0] [d1] ... [d7]\n"
> +	"can recv, abort with CTRL-C\n"

does the help really display correctly here ?  i think the "can status" line 
will have too many "can"'s ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/7d9b8d17/attachment.pgp 

  parent reply	other threads:[~2009-11-01 14:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-01 11:33 [U-Boot] [RFC 0/5] CAN framework for U-Boot Wolfgang Grandegger
2009-11-01 11:33 ` [U-Boot] [RFC 1/5] CAN interface library Wolfgang Grandegger
2009-11-01 11:33   ` [U-Boot] [RFC 2/5] CAN device test command Wolfgang Grandegger
2009-11-01 11:33     ` [U-Boot] [RFC 3/5] CAN device driver for the SJA1000 Wolfgang Grandegger
2009-11-01 11:33       ` [U-Boot] [RFC 4/5] CAN device driver for the Intel 82527 Wolfgang Grandegger
2009-11-01 11:33         ` [U-Boot] [RFC 5/5] CAN interface support for the TQM855L module Wolfgang Grandegger
2009-11-02 12:02       ` [U-Boot] [RFC 3/5] CAN device driver for the SJA1000 Matthias Fuchs
2009-11-02 12:50         ` Wolfgang Grandegger
2009-11-02 14:22           ` Matthias Fuchs
2009-11-02 20:20             ` Wolfgang Grandegger
2009-11-05 20:28               ` Wolfgang Denk
2009-11-01 14:45     ` Mike Frysinger [this message]
2009-11-01 16:24       ` [U-Boot] [RFC 2/5] CAN device test command Wolfgang Grandegger
2009-11-01 18:07         ` Mike Frysinger
2009-11-01 14:36   ` [U-Boot] [RFC 1/5] CAN interface library Mike Frysinger
2009-11-01 16:16     ` Wolfgang Grandegger
2009-11-01 18:05       ` Mike Frysinger
2009-11-01 22:00         ` Wolfgang Grandegger

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=200911010945.12254.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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