Changeset 5885
- Timestamp:
- 11/26/10 11:25:32 (2 years ago)
- Location:
- i2c-tools/trunk
- Files:
-
- 7 modified
-
CHANGES (modified) (1 diff)
-
tools/i2cbusses.c (modified) (5 diffs)
-
tools/i2cbusses.h (modified) (3 diffs)
-
tools/i2cdetect.c (modified) (2 diffs)
-
tools/i2cdump.c (modified) (2 diffs)
-
tools/i2cget.c (modified) (2 diffs)
-
tools/i2cset.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/CHANGES
r5884 r5885 17 17 eepromer: Fix array initialization overrun 18 18 i2cdetect: Drop legacy reference to ISA bus 19 Drop arbitrarylimit on I2C bus number20 i2cdump: Drop arbitrarylimit on I2C bus number21 i2cget: Drop arbitrarylimit on I2C bus number19 Increase limit on I2C bus number 20 i2cdump: Increase limit on I2C bus number 21 i2cget: Increase limit on I2C bus number 22 22 i2cset: Add support for short writes with PEC 23 Drop arbitrarylimit on I2C bus number23 Increase limit on I2C bus number 24 24 i2c-stub-from-dump: Use udev settle to speed up initialization 25 25 Unload i2c-stub automatically if needed -
i2c-tools/trunk/tools/i2cbusses.c
r5884 r5885 5 5 Copyright (c) 1999-2003 Frodo Looijaard <frodol@dds.nl> and 6 6 Mark D. Studebaker <mdsxyz123@yahoo.com> 7 Copyright (C) 2008 Jean Delvare <khali@linux-fr.org>7 Copyright (C) 2008-2010 Jean Delvare <khali@linux-fr.org> 8 8 9 9 This program is free software; you can redistribute it and/or modify … … 23 23 */ 24 24 25 /* For strdup */25 /* For strdup and snprintf */ 26 26 #define _BSD_SOURCE 1 27 27 … … 68 68 enum adt ret; 69 69 70 file = open_i2c_dev(i2cbus, filename, 1);70 file = open_i2c_dev(i2cbus, filename, sizeof(filename), 1); 71 71 if (file < 0) 72 72 return adt_unknown; … … 341 341 return lookup_i2c_bus_by_name(i2cbus_arg); 342 342 } 343 if (i2cbus > INT_MAX) {343 if (i2cbus > 0xFFFFF) { 344 344 fprintf(stderr, "Error: I2C bus out of range!\n"); 345 345 return -2; … … 372 372 } 373 373 374 int open_i2c_dev( const int i2cbus, char *filename, constint quiet)374 int open_i2c_dev(int i2cbus, char *filename, size_t size, int quiet) 375 375 { 376 376 int file; 377 377 378 sprintf(filename, "/dev/i2c/%d", i2cbus); 378 snprintf(filename, size, "/dev/i2c/%d", i2cbus); 379 filename[size - 1] = '\0'; 379 380 file = open(filename, O_RDWR); 380 381 -
i2c-tools/trunk/tools/i2cbusses.h
r5241 r5885 2 2 i2cbusses.h - Part of the i2c-tools package 3 3 4 Copyright (C) 2004-20 07Jean Delvare <khali@linux-fr.org>4 Copyright (C) 2004-2010 Jean Delvare <khali@linux-fr.org> 5 5 6 6 This program is free software; you can redistribute it and/or modify … … 23 23 #define _I2CBUSSES_H 24 24 25 #include <unistd.h> 26 25 27 struct i2c_adap { 26 28 int nr; … … 35 37 int lookup_i2c_bus(const char *i2cbus_arg); 36 38 int parse_i2c_address(const char *address_arg); 37 int open_i2c_dev( const int i2cbus, char *filename, constint quiet);39 int open_i2c_dev(int i2cbus, char *filename, size_t size, int quiet); 38 40 int set_slave_addr(int file, int address, int force); 39 41 -
i2c-tools/trunk/tools/i2cdetect.c
r5862 r5885 1 1 /* 2 2 i2cdetect.c - a user-space program to scan for I2C devices 3 Copyright (C) 1999-2004 Frodo Looijaard <frodol@dds.nl>, 4 Mark D. Studebaker <mdsxyz123@yahoo.com> and5 Jean Delvare <khali@linux-fr.org>3 Copyright (C) 1999-2004 Frodo Looijaard <frodol@dds.nl>, and 4 Mark D. Studebaker <mdsxyz123@yahoo.com> 5 Copyright (C) 2004-2010 Jean Delvare <khali@linux-fr.org> 6 6 7 7 This program is free software; you can redistribute it and/or modify … … 296 296 } 297 297 298 file = open_i2c_dev(i2cbus, filename, 0);298 file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0); 299 299 if (file < 0) { 300 300 exit(1); -
i2c-tools/trunk/tools/i2cdump.c
r5242 r5885 3 3 Copyright (C) 2002-2003 Frodo Looijaard <frodol@dds.nl>, and 4 4 Mark D. Studebaker <mdsxyz123@yahoo.com> 5 Copyright (C) 2004-20 08Jean Delvare <khali@linux-fr.org>5 Copyright (C) 2004-2010 Jean Delvare <khali@linux-fr.org> 6 6 7 7 This program is free software; you can redistribute it and/or modify … … 260 260 } 261 261 262 file = open_i2c_dev(i2cbus, filename, 0);262 file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0); 263 263 if (file < 0 264 264 || check_funcs(file, size, pec) -
i2c-tools/trunk/tools/i2cget.c
r5242 r5885 1 1 /* 2 2 i2cget.c - A user-space program to read an I2C register. 3 Copyright (C) 2005-20 08Jean Delvare <khali@linux-fr.org>3 Copyright (C) 2005-2010 Jean Delvare <khali@linux-fr.org> 4 4 5 5 Based on i2cset.c: … … 213 213 } 214 214 215 file = open_i2c_dev(i2cbus, filename, 0);215 file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0); 216 216 if (file < 0 217 217 || check_funcs(file, size, daddress, pec) -
i2c-tools/trunk/tools/i2cset.c
r5771 r5885 3 3 Copyright (C) 2001-2003 Frodo Looijaard <frodol@dds.nl>, and 4 4 Mark D. Studebaker <mdsxyz123@yahoo.com> 5 Copyright (C) 2004-20 09Jean Delvare <khali@linux-fr.org>5 Copyright (C) 2004-2010 Jean Delvare <khali@linux-fr.org> 6 6 7 7 This program is free software; you can redistribute it and/or modify … … 237 237 } 238 238 239 file = open_i2c_dev(i2cbus, filename, 0);239 file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0); 240 240 if (file < 0 241 241 || check_funcs(file, size, pec)
