1616#include < iostream>
1717#include < vector>
1818#include < arpa/inet.h>
19- #include < stdlib.h>
19+ #include < stdlib.h>
2020// #include "i2cbusses.h"
2121// #include <linux/i2c.h>
2222#include < linux/i2c-dev.h>
@@ -83,7 +83,7 @@ RPC_SRV_RESULT I2CBusAccess::is_it_network_node(std::string devnode,int &port,st
8383 istringstream f (devnode);// "192.168.1.1,40001");
8484 string s,str1,str2;
8585 ip=" none" ;
86- port=-1 ;
86+ port=-1 ;
8787
8888 while (getline (f, s, ' :' ))
8989 {
@@ -140,7 +140,7 @@ RPC_SRV_RESULT I2CBusAccess::is_it_device_node(std::string devnode)
140140/* ****************************************************************************/
141141RPC_SRV_RESULT I2CBusAccess::SetSlaveAddr (uint8_t addr)
142142{
143- if (ioctl (fd, I2C_SLAVE, addr) < 0 )
143+ if (ioctl (fd, I2C_SLAVE, addr) < 0 )
144144 {
145145 // cout<<"I2CBusAccess::SetSlaveAddr:Unable to Set Slave Addr to "<<addr<<endl;
146146 return RPC_SRV_RESULT_BUS_ERROR;// RPC_SRV_RESULT_FAIL;
@@ -178,7 +178,7 @@ RPC_SRV_RESULT I2CBusAccess::read_byte(uint32_t addr, uint8_t *data)
178178 RPC_SRV_RESULT retval=Client.get_integer_type_with_addr_para ((char *)RPCMGR_RPC_MW_BYTE_GET,(char *)RPCMGR_RPC_MW_ARGADDR,addr,(char *)RPCMGR_RPC_MW_ARGDATA,tmpbuf);
179179 if (retval==RPC_SRV_RESULT_SUCCESS)
180180 *data=(uint8_t )atoi (tmpbuf);
181- return retval;
181+ return retval;
182182 }
183183 else
184184 return RPC_SRV_RESULT_FAIL;
@@ -236,7 +236,7 @@ RPC_SRV_RESULT I2CBusAccess::read_word(uint32_t addr, uint16_t *data)
236236 RPC_SRV_RESULT retval=Client.get_integer_type_with_addr_para ((char *)RPCMGR_RPC_MW_WORD_GET,(char *)RPCMGR_RPC_MW_ARGADDR,addr,(char *)RPCMGR_RPC_MW_ARGDATA,tmpbuf);
237237 if (retval==RPC_SRV_RESULT_SUCCESS)
238238 *data=(uint16_t )atoi (tmpbuf);
239- return retval;
239+ return retval;
240240 }
241241 else
242242 return RPC_SRV_RESULT_FAIL;
@@ -288,7 +288,7 @@ RPC_SRV_RESULT I2CBusAccess::read_dword(uint32_t addr, uint32_t *data)
288288 RPC_SRV_RESULT retval=Client.get_integer_type_with_addr_para ((char *)RPCMGR_RPC_MW_DWORD_GET,(char *)RPCMGR_RPC_MW_ARGADDR,addr,(char *)RPCMGR_RPC_MW_ARGDATA,tmpbuf);
289289 if (retval==RPC_SRV_RESULT_SUCCESS)
290290 *data=(uint32_t )atoi (tmpbuf);// TODO: check if atol is needed
291- return retval;
291+ return retval;
292292 }
293293 else
294294 return RPC_SRV_RESULT_FAIL;
@@ -351,7 +351,7 @@ RPC_SRV_RESULT I2CBusAccess::test_write_byte(char* dev,uint8_t addr, uint8_t dat
351351{
352352 int myfd;
353353 myfd = open (dev, O_RDWR);
354- if (myfd < 0 )
354+ if (myfd < 0 )
355355 {
356356 // printf("I2CBusAccess::test_write_byte:Error opening file: %s\n", strerror(errno));
357357 // return RPC_SRV_RESULT_FILE_OPEN_ERR;
@@ -364,15 +364,15 @@ RPC_SRV_RESULT I2CBusAccess::test_write_byte(char* dev,uint8_t addr, uint8_t dat
364364 }
365365 }
366366 // fcntl(myfd, F_SETFL,fcntl(myfd, F_GETFL) | O_NONBLOCK);
367- if (ioctl (myfd, I2C_SLAVE, addr) < 0 )
367+ if (ioctl (myfd, I2C_SLAVE, addr) < 0 )
368368 {
369369 // printf("I2CBusAccess::test_write_byte:ioctl error: %s\n", strerror(errno));
370370 return RPC_SRV_RESULT_FILE_WRITE_ERR;
371371 }
372372 uint8_t buff[16 ];buff[0 ]=data;
373373 // int val=atoi(argv[1]);
374374 unsigned int tst=data;
375- int sz=I2C_WRITE (myfd, &tst, 1 );// != 1)
375+ int sz=I2C_WRITE (myfd, &tst, 1 );// != 1)
376376 if (sz!=1 )
377377 {
378378 // printf("I2CBusAccess::test_write_byte:Error writing file:written %d bytes, errorno:%s\n",sz,strerror(errno));
@@ -419,6 +419,3 @@ int32_t I2CBusAccess::i2c_smbus_write_byte(int file,uint8_t value)
419419#endif
420420}
421421/* ****************************************************************************/
422-
423-
424-
0 commit comments