Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 1999 15:52:32 +0100
From:      Nicolas Souchu <nsouch@teaser.fr>
To:        Brian Feldman <green@unixhelp.org>
Cc:        hardware@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: Aladdin chipset SMBus support available!
Message-ID:  <19990214155232.61732@breizh.prism.uvsq.fr>
In-Reply-To: <Pine.BSF.4.05.9902140837390.3507-100000@janus.syracuse.net>; from Brian Feldman on Sun, Feb 14, 1999 at 08:40:11AM -0500
References:  <19990214095845.56909@breizh.prism.uvsq.fr> <Pine.BSF.4.05.9902140837390.3507-100000@janus.syracuse.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Mm9M+Fa2AknHoGS/
Content-Type: text/plain; charset=us-ascii

On Sun, Feb 14, 1999 at 08:40:11AM -0500, Brian Feldman wrote:
>
>On Sun, 14 Feb 1999, Nicolas Souchu wrote:
>
>> On Sat, Feb 13, 1999 at 05:22:00PM -0500, Brian Feldman wrote:
>> >
>> >On Sat, 13 Feb 1999, Nicolas Souchu wrote:
>> >
>> >> Example program to fetch temperature or voltages is available at
>> >> http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/examples/
>> >> There's also an example program to fetch SDRAM info over the smbus.
>> 
>> I attach you the detect.c program. It's very simple and may help us
>> in knowing what I2C hardware you have on your mobo.
>
>Where's my detect.c? I think you forgot to attach it :)

:) here it is!

>
>> >I tried them, and there's the problem: all the ioctl()s they perform return
>> >EINTR! Has this driver been tested on many motherboards? Why should I expect
>> >an EINTR? Just wondering :)
>> 
>> EINTR is odd. It just mean that the device at the address requested on the
>> I2C bus do not respond. I have to translate SMBus errors to the appropriate
>> unix ones.
>
>Hmm... wouldn't the appropriate error for something not responding be an
>ENXIO or ETIMEDOUT? EINTR seems more than a little wrong for this purpouse.

Fix committed.

BTW, as outlined by -pkh all this is just a first step in a huge monitoring
adventure where all still need to be _defined_ (architecture and interfaces)
and implemented. Any proposition for doing the job is wellcome,
since I just have enough time to do the hardware SMBus support.

Nicholas

-- 
nsouch@teaser.fr / nsouch@freebsd.org
FreeBSD - Turning PCs into workstations - http://www.FreeBSD.org

--Mm9M+Fa2AknHoGS/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="detect.c"

/*-
 * Copyright (c) 1999 Nicolas Souchu
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	[id for your version control system, if any]
 */
/*This program is prototype version. I'll write better one*/
#include <stdlib.h>
#include <fcntl.h>
#include <machine/smb.h>
const double vfactor[]={1,1,1,1.67,4,-4,-1.67};
const char *Inpname[]={
  "Vcore","Vit","VIO","+5V","+12V","-12V","-5V"
};

int doioctl(int alias, int cmd, caddr_t param)
{
	int error = 1;
	int retry = 3;

	while (error && retry--) {
		usleep(200);
		error = ioctl(alias, cmd, param);
	}
	
	return (error);
}

int main (int argc,char argv[])
{
	int alias, i;
	unsigned char byte=0;
	struct smbcmd cmd;

	bzero(&cmd, sizeof(cmd));
	cmd.data.byte_ptr = &byte;

	alias = open("/dev/smb0", O_RDWR);

	for (i=2; i<254; i+=2)
	{
	  cmd.slave=(u_char)i;
	  if(doioctl(alias, SMB_RECVB, (caddr_t)&cmd)!=-1){
		printf("%x found.\n",i);
	  }
	}

	close(alias);
	return 0;
}


--Mm9M+Fa2AknHoGS/--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990214155232.61732>