Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(kernel) headers glue in /usr/include/linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
crazyjaap
n00b
n00b


Joined: 31 Mar 2005
Posts: 7
Location: Netherlands

PostPosted: Thu Mar 31, 2005 10:23 am    Post subject: (kernel) headers glue in /usr/include/linux Reply with quote

Hello all,

Since monday, I can't compile a program anymore, which compiled fine last
week.
It is rather simple (see below...).

I also know (partly) why it doesn't compile anymore; when I take the
/usr/include/linux/* from 2004.3 stage 3 it works fine, but apparently
these files are changed since this weekend (emerge sync && emerge -uv
system && emerge -uv world )

When I look into the problem in more detail, I notice the following:

Current version i2c.h and i2c-dev.h:
/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */
/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */

When I compile my program:
In file included from distance.c:5:
/usr/include/linux/i2c-dev.h:37: error: parse error before '*' token
/usr/include/linux/i2c-dev.h:42: error: parse error before '*' token
/usr/include/linux/i2c-dev.h:44: error: parse error before '}' token

Versions in kernel-2.6.11.5 directory:
/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */
/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */


Version from gentoo 2004.3 stage3 (x86):
/* $Id: i2c.h,v 1.46 2001/08/31 00:04:07 phil Exp $ */
/* $Id: i2c-dev.h,v 1.9 2001/08/15 03:04:58 mds Exp $ */


With this last version (2004.3 stage3) the program compiles fine.

Since when are these headers updated? Were to look for more help?

greetingz,

Jaap Crezee
The Netherlands


------------

//distance.c:

#include <stdio.h>
#include <time.h>

#include <linux/i2c.h>
#include <linux/i2c-dev.h>

#include <sys/time.h>

#include <fcntl.h>
#include <err.h>

#define AANTAL 35

int file;

int chip_open()
{
int dummy;
file = open("/dev/i2c/0", O_RDWR);
dummy = ioctl(file, I2C_SLAVE, 0x21);
return dummy;
}

int chip_close()
{
int dummy;
dummy = close(file);
}

int chip_write(int value)
{
return (int)i2c_smbus_write_byte(file, (__u8)value);
}

int chip_read()
{
return (int)i2c_smbus_read_byte(file);
}

int main(int argc, char *argv[])
{
struct timeval tt[AANTAL];
struct timeval t1, t2;
__u8 dummy[AANTAL];
long blaat1, blaat2;
register int counter, counter2;
int distance;

__u8 val1, val2, val;

//chip_open(0x21);
chip_open();

val1 = 0x1;
val2 = 0x0;

gettimeofday(&t1, 0);

for (counter2=0; counter2<(AANTAL*3); counter2++)
{
i2c_smbus_write_byte(file, val1);
usleep(10);
i2c_smbus_write_byte(file, val2);

for (counter=0; counter<AANTAL; counter++)
{
dummy[counter] = i2c_smbus_read_byte(file);
//printf("%d\n", dummy[counter]);
}

distance = 0;
for (counter=0; counter<AANTAL; counter++)
{
val = dummy[counter];
if ((val & 0x2) == 0x2)
{
distance++;
}
else
{
break;
}
}
usleep(100);
printf("Distance: %d ", distance);
usleep(10);
}

gettimeofday(&t2, 0);

blaat1 = t2.tv_sec - t1.tv_sec;
blaat2 = t2.tv_usec - t1.tv_usec;
if (blaat2 < 0)
{
blaat2 = abs(blaat2);
blaat1++;
}
printf("start: %d,%d end: %d, %d diff: %d,%d\n dists/sec:%d\n", t1.tv_sec, t1.tv_usec, t2.tv_sec, t2.tv_usec,
blaat1, blaat2, (AANTAL*3)/blaat1);
chip_close();
}
Back to top
View user's profile Send private message
Adwin
Tux's lil' helper
Tux's lil' helper


Joined: 13 Mar 2005
Posts: 128
Location: Poland

PostPosted: Thu Mar 31, 2005 3:20 pm    Post subject: Reply with quote

i2c is the pathway for things like hardware monitoring / temperature / fan speed, etc...
Perhaps you changed kernel ver?
Do you use modules? monolithic kernel?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum