1 /* hci.c -- Hardware Configuration Interface
3 * Copyright (c) 1998-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
6 * Revision 1.2 2003/11/06 12:48:08 noberasco
7 * Added a new machine id...
9 * Revision 1.1 2003/09/18 16:38:27 noberasco
12 * Revision 1.1.1.1 2003/06/05 09:34:03 noberasco
15 * Revision 1.5 2002/01/27 13:22:57 jab
16 * updated list of machine ID's
18 * Revision 1.4 2001/10/05 13:04:43 jab
19 * checked in change to using kernel module
21 * Revision 1.3 1999/12/12 11:33:39 jab
22 * changed assembler to save registers, should make the programs stabler
23 * slightly fudged addition to GetMachineID to get SCTTable ID's
25 * Revision 1.2 1999/08/15 10:43:28 jab
26 * removed the HciGet and HciSet and replaced with HciFunction
28 * Revision 1.1 1999/03/11 20:27:06 jab
32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version.
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
42 * You should have received a copy of the GNU General Public License
43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 static const char rcsid
[]="$Id: hci.c,v 1.2 2003/11/06 12:48:08 noberasco Exp $";
60 int HciFunction(SMMRegisters
*regs
)
64 if ((fd
=open(TOSH_DEVICE
, O_RDWR
))<0)
67 if (access(TOSH_PROC
, R_OK
)) {
72 if (ioctl(fd
, TOSH_SMM
, regs
)<0) {
79 return (int) (regs
->eax
& 0xff00)>>8;
84 * Return the BIOS version of the laptop
86 int HciGetBiosVersion(void)
92 if (access(TOSH_PROC
, R_OK
))
95 /* open /proc/toshiba for reading */
97 if (!(str
= fopen(TOSH_PROC
, "r")))
100 /* scan in the information */
102 fgets(buffer
, sizeof(buffer
)-1, str
);
104 buffer
[sizeof(buffer
)-1] = '\0';
105 sscanf(buffer
, "%*s %*x %*d.%*d %d.%d %*x %*x\n", &major
, &minor
);
107 /* return the information */
109 return (major
*0x100)+minor
;
114 * Get the Toshiba machine identification number
116 int HciGetMachineID(int *id
)
121 if (access(TOSH_PROC
, R_OK
))
124 /* open /proc/toshiba for reading */
126 if (!(str
= fopen(TOSH_PROC
, "r")))
129 /* scan in the information */
131 fgets(buffer
, sizeof(buffer
)-1, str
);
133 buffer
[sizeof(buffer
)-1] = '\0';
134 sscanf(buffer
, "%*s %x %*d.%*d %*d.%*d %*x %*x\n", (unsigned int *) id
);
141 * Return the LCD Panel type
143 int HciGetLCDPanelType(int *resolution
, int *type
)
148 regs
.ebx
= HCI_FLAT_PANEL
;
151 *resolution
= (regs
.ecx
& 0xff00)>>8;
152 *type
= regs
.ecx
& 0xff;