Giuseppe Corbelli
2014-Jul-08 07:29 UTC
[Nut-upsdev] [PATCH] Support for ASEM UPS on Linux/i2c
On 08/07/2014 01:02, Charles Lepple wrote:>>> Sorry I did not test this sooner - this went to Gmane but not to my email. >>> If you have time, could you please write up a quick man page for this driver? >>> >>> Also, there seem to be some missing symbols and include files: >>> >>> http://buildbot.networkupstools.org/public/nut/waterfall?branch=asem_i2c >> >> The problem is that linux/i2c-dev.h must come from libi2c-dev to define the required functions. Same header is part of the kernel, but without required functions. Changed the configure.ac check to look for the functions, not just the header. >> To build the driver you'll need libi2c-dev package (part of i2c-tools) on debian. > > libi2c-dev is now installed on the ubuntu-trusty builder. > > configure:10067: checking whether i2c_smbus_read_word_data is declared > configure:10067: gcc -c -g -O2 -Wall -Wsign-compare conftest.c >&5 > In file included from conftest.c:72:0: > /usr/include/linux/i2c-dev.h: In function 'i2c_smbus_write_quick': > /usr/include/linux/i2c-dev.h:176:55: error: 'NULL' undeclared (first use in this function) > return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL); > ^ > /usr/include/linux/i2c-dev.h:176:55: note: each undeclared identifier is reported only once for each function it appears in > /usr/include/linux/i2c-dev.h: In function 'i2c_smbus_write_byte': > /usr/include/linux/i2c-dev.h:191:41: error: 'NULL' undeclared (first use in this function) > I2C_SMBUS_BYTE,NULL); > > Ref: > http://buildbot.networkupstools.org/public/nut/builders/Ubuntu-trusty-x64/builds/20/steps/configure/logs/config.logSeems that on x64 architectures NULL is not #defined in <stddef.h> the attached patch #includes <stdio.h> in AC_CHECK_DECLS. Tested on an ubuntu 12.10 x64, seems to solve the issue. -- Giuseppe Corbelli WASP Software Engineer, Copan Italia S.p.A Phone: +390303666318 Fax: +390302659932 E-mail: giuseppe.corbelli at copanitalia.com -------------- next part -------------- A non-text attachment was scrubbed... Name: asem.patch Type: text/x-patch Size: 552 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20140708/ab8739d5/attachment.bin>
Charles Lepple
2014-Jul-09 01:46 UTC
[Nut-upsdev] [PATCH] Support for ASEM UPS on Linux/i2c
On Jul 8, 2014, at 3:29 AM, Giuseppe Corbelli <giuseppe.corbelli at copanitalia.com> wrote:> Seems that on x64 architectures NULL is not #defined in <stddef.h> > the attached patch #includes <stdio.h> in AC_CHECK_DECLS. Tested on an ubuntu 12.10 x64, seems to solve the issue.I am a little confused as to how you are testing this :-) The driver still wouldn't compile on Ubuntu 14.04 with libi2c-dev. The "#if HAVE_LINUX_I2C_DEV_H" won't be satisfied until after config.h is included (typically by main.h). Since the driver won't even be compiled if WITH_LINUX_I2C is not defined, I took out the #if wrapper. Also, since the intermediate commits aren't terribly useful, I'll collapse the asem_i2c_take2 branch into a single commit before merging to master. Here is the branch as it stands: https://github.com/networkupstools/nut/compare/asem_i2c_take2 -- Charles Lepple clepple at gmail
Giuseppe Corbelli
2014-Jul-09 07:56 UTC
[Nut-upsdev] [PATCH] Support for ASEM UPS on Linux/i2c
On 09/07/2014 03:46, Charles Lepple wrote:> On Jul 8, 2014, at 3:29 AM, Giuseppe Corbelli <giuseppe.corbelli at copanitalia.com> wrote: > >> Seems that on x64 architectures NULL is not #defined in <stddef.h> >> the attached patch #includes <stdio.h> in AC_CHECK_DECLS. Tested on an ubuntu 12.10 x64, seems to solve the issue. > > I am a little confused as to how you are testing this :-)Developed and tested on a Debian x86, got hold of an Ubuntu x64 to see what was going wrong, but I don't have the UPS on x64 machines.> The driver still wouldn't compile on Ubuntu 14.04 with libi2c-dev. The > "#if HAVE_LINUX_I2C_DEV_H" won't be satisfied until after config.h is included > (typically by main.h). Since the driver won't even be compiled if > WITH_LINUX_I2C is not defined, I took out the #if wrapper.My bad.> Also, since the intermediate commits aren't terribly useful, I'll collapse > the asem_i2c_take2 branch into a single commit before merging to master. Here > is the branch as it stands: > > https://github.com/networkupstools/nut/compare/asem_i2c_take2Looks fine to me. -- Giuseppe Corbelli WASP Software Engineer, Copan Italia S.p.A Phone: +390303666318 Fax: +390302659932 E-mail: giuseppe.corbelli at copanitalia.com