@@ -74,6 +74,7 @@ bool i2c_smbus_linux_detect()
7474{
7575 i2c_smbus_linux * bus;
7676 char device_string[1024 ];
77+ char device_path[1024 ];
7778 DIR * dir;
7879 char driver_path[512 ];
7980 struct dirent * ent;
@@ -109,6 +110,7 @@ bool i2c_smbus_linux_detect()
109110 if (test_fd)
110111 {
111112 memset (device_string, 0x00 , sizeof (device_string));
113+ memset (device_path, 0x00 , sizeof (device_string));
112114
113115 if (read (test_fd, device_string, sizeof (device_string)) < 0 )
114116 {
@@ -220,17 +222,18 @@ bool i2c_smbus_linux_detect()
220222 close (test_fd);
221223 }
222224
223- strcpy (device_string , " /dev/" );
224- strcat (device_string , ent->d_name );
225- test_fd = open (device_string , O_RDWR);
225+ strcpy (device_path , " /dev/" );
226+ strcat (device_path , ent->d_name );
227+ test_fd = open (device_path , O_RDWR);
226228
227229 if (test_fd < 0 )
228230 {
229231 ret = false ;
230232 }
231233
232234 bus = new i2c_smbus_linux ();
233- strcpy (bus->device_name , device_string);
235+ strcpy (bus->device_name , device_path);
236+ strcpy (bus->bus_name , device_string);
234237 bus->handle = test_fd;
235238 bus->pci_device = pci_device;
236239 bus->pci_vendor = pci_vendor;
0 commit comments