Jean Delvare
051304c49a
i2c-tools: Implement and document option -h
Add an option -h to display the help of the tools. This is a common
practice so users may expect it to work.
Based on a preliminary patch from David Kerns.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
3 years ago
Jean Delvare
b295772910
i2c-tools: Use getopt
Use the standard C getopt() function instead of parsing the options
manually. The benefit of this move is that getopt() supports merged
flags (for example -fy instead of -f -y) and does not require options
to come first on the command line. As this is pretty standard by now,
not supporting such possibilities can confuse and disappoint the user.
Based on a preliminary patch from David Kerns.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
3 years ago
Jean Delvare
a235aabbff
i2cset: Fix short writes with mask
Short writes used "daddress" for the value, but the masking code did
not expect that, and instead applied the mask to a variable that was
never used.
So change short writes to use "value" for the value, as all other
commands do. Adjust all code paths accordingly.
Reported by David Jedynak.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
5 years ago
Wolfram Sang
78edfefbcc
tools: restrict all addresses defined by the standard
The I2C standard reserves addresses 0x03-0x07. Adapt our tools to that.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
6 years ago
Romain Porte
702804251c
tools: add all_addrs option for i2c tools
If the user is sure that the reserved 0x00 - 0x02 and 0x77 - 0x7f ranges
are not needed by its devices, then the "-a" option can be passed for
allowing all theorical addresses to be used. It is then possible to
access devices in this address range.
Signed-off-by: Romain Porte <romain.porte@nokia.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
[wsa: imonr fixes to commit message]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
8 years ago
Jean Delvare
4bbad0fae1
Update my e-mail address and copyright years.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6224 7894878c-1315-0410-8ee3-d5d059ff63e0
12 years ago
Jean Delvare
81a3820cbd
Add missing option -r to usage summary
Reported by Jaromir Capik.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6201 7894878c-1315-0410-8ee3-d5d059ff63e0
12 years ago
Jean Delvare
93caf007f4
i2c-dev: Move SMBus helper functions to include/i2c/smbus.h
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6048 7894878c-1315-0410-8ee3-d5d059ff63e0
13 years ago
Guenter Roeck
055f5effa9
i2cset: Check range for data value mask
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5927 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
6fdf1f1e45
i2cset: Get command/mode before reading data
Get and validate the command/mode parameter for all commands
before reading and evaluating actual data.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5926 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
8da93bb0f2
i2cset: More stringent parameter validation
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5924 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
7b4639c497
i2cset: Abort if value mask is set for block commands
Specifying the value mask is not supported for block commands,
abort if it is specified anyway.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5923 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
bacad27586
i2cset: Check number of arguments for block data writes
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5922 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
7dd2610269
i2cset: Removed obsolete method to specify value mask
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5921 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
37ad9258ab
i2cset: Replace blanks at beginning of line with tabs
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5920 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Guenter Roeck
fcc8ce36b8
Added support to write SMBus and I2C block commands to i2cset
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5911 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Jean Delvare
3a5d21649e
Use a 20-bit limit for the i2c bus number.
Use snprintf for the i2c dev node name.
Update copyright years.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5885 7894878c-1315-0410-8ee3-d5d059ff63e0
15 years ago
Jean Delvare
2ea4dccae0
Add support for short writes with PEC.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5771 7894878c-1315-0410-8ee3-d5d059ff63e0
16 years ago
Jean Delvare
0e972ad9fd
Add support for reading back to short writes.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5394 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
35a929de32
Make reading back the written value optional.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5393 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
0c270e09de
Allow masking on short writes.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5391 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
c797cbaaeb
Set the data value mask with -m. The old method is still supported for
compatibility, but is considered deprecated and is no longer documented.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5390 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
54cee12770
Use consistent transaction names (based on the SMBus specification)
when complaining about a missing adapter functionality.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5242 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
fc38f35ce4
Share the error string between all functionality checks.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5241 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
f67174055a
No need to print the i2c bus number in functionality error message.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5240 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
c3d335575f
Add support for short writes (SMBus send byte).
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5237 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
7ad89259ab
List the optional command line parameters in a consistent way.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5236 7894878c-1315-0410-8ee3-d5d059ff63e0
17 years ago
Jean Delvare
8cc44b8c9c
Whitespace cleanups.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5210 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
8603e2aab2
Move the confirmation to a separate function, as is done in i2cget
already.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5209 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
87154f13cc
Move the functionality checks to a separate function, as is done in
i2cget already.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5208 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
68fb2e6229
Minor optimizations and cleanups.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5207 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
2751626db8
Unknown options are fatal, so label them error rather than warning.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5206 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
bdfc87d724
Move the chip address parsing to a common function for consistency.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5204 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
2e942d16a5
Consistently restrict the allowed I2C device address to 0x03 - 0x77.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5203 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
2c57ef91a2
Unify and shorten the usage messages. The details can be found in
the man pages so no need to be verbose.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5201 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
b68190b426
Don't print the list of i2c buses as part of the help.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5200 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
adc03e3cf3
Make the includes order correct and consistent accross all tools.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5199 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
eda5918d0f
Refactor the handling of the I2CBUS parameter. This ensures more
consistency accross the i2c tools.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5193 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
aed7163f2b
Update the FSF address.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5164 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
afff1260eb
Final status messages go to stdout.
Fix two harmless file descriptor leaks.
Don't return an error when readback fails or doesn't match, it might be OK.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5001 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
fcb6bce3c8
Rename I2C_FUNC_SMBUS_HWPEC_CALC to I2C_FUNC_SMBUS_PEC, as was done
in the Linux 2.6 kernel.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@4948 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
7457b172b0
Show more warnings, and fix them.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@4499 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
0edf1c69c9
Add a Makefile to build, install and uninstall the tools, and make
them build again.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@4487 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago
Jean Delvare
c922a78bb4
Oops, forgot to create the trunk level.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@4481 7894878c-1315-0410-8ee3-d5d059ff63e0
18 years ago