Browse Source

Properly handle the rare case where /dev/i2c exists but isn't a

directory. Patch from Florian Fainelli.


git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5854 7894878c-1315-0410-8ee3-d5d059ff63e0
tags/v3.0.3
Jean Delvare 15 years ago
parent
commit
e8c558c9a5
  1. 1
      CHANGES
  2. 2
      tools/i2cbusses.c

1
CHANGES

@ -18,6 +18,7 @@ SVN
i2c-stub-from-dump: Use udev settle to speed up initialization i2c-stub-from-dump: Use udev settle to speed up initialization
Unload i2c-stub automatically if needed Unload i2c-stub automatically if needed
Add support for multiple dumps Add support for multiple dumps
tools: Properly handle /dev/i2c not being a directory
3.0.2 (2008-11-29) 3.0.2 (2008-11-29)
i2c-dev.h: Drop I2C_FUNC_SMBUS_*I2C_BLOCK_2 defines i2c-dev.h: Drop I2C_FUNC_SMBUS_*I2C_BLOCK_2 defines

2
tools/i2cbusses.c

@ -378,7 +378,7 @@ int open_i2c_dev(const int i2cbus, char *filename, const int quiet)
sprintf(filename, "/dev/i2c/%d", i2cbus); sprintf(filename, "/dev/i2c/%d", i2cbus);
file = open(filename, O_RDWR); file = open(filename, O_RDWR);
if (file < 0 && errno == ENOENT) {
if (file < 0 && (errno == ENOENT || errno == ENOTDIR)) {
sprintf(filename, "/dev/i2c-%d", i2cbus); sprintf(filename, "/dev/i2c-%d", i2cbus);
file = open(filename, O_RDWR); file = open(filename, O_RDWR);
} }

Loading…
Cancel
Save