Create a structure to hold client information in the network server and fix i2c hanging on destructor when bus is not available.
This commit is contained in:
parent
9b8a0d465e
commit
6bfc9dd9db
3 changed files with 55 additions and 44 deletions
|
|
@ -256,9 +256,6 @@ void DetectI2CBusses()
|
|||
device_string[strlen(device_string) - 1] = 0x00;
|
||||
|
||||
close(test_fd);
|
||||
|
||||
bus = new i2c_smbus_linux();
|
||||
strcpy(bus->device_name, device_string);
|
||||
|
||||
strcpy(device_string, "/dev/");
|
||||
strcat(device_string, ent->d_name);
|
||||
|
|
@ -266,11 +263,12 @@ void DetectI2CBusses()
|
|||
|
||||
if (test_fd < 0)
|
||||
{
|
||||
delete bus;
|
||||
ent = readdir(dir);
|
||||
continue;
|
||||
}
|
||||
|
||||
bus = new i2c_smbus_linux();
|
||||
strcpy(bus->device_name, device_string);
|
||||
bus->handle = test_fd;
|
||||
busses.push_back(bus);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue