summaryrefslogtreecommitdiffstats
path: root/perl-install/printer.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-07-24 22:39:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-07-24 22:39:28 +0000
commitb60c0cb8f67d745626fec6f0c8540818f24e91a6 (patch)
tree783189547888703c391b1719cf9ceaacb1e1aa63 /perl-install/printer.pm
parent0a96d505550060312a1cd9a04a9ae9bf23ebdaa2 (diff)
downloaddrakx-backup-do-not-use-b60c0cb8f67d745626fec6f0c8540818f24e91a6.tar
drakx-backup-do-not-use-b60c0cb8f67d745626fec6f0c8540818f24e91a6.tar.gz
drakx-backup-do-not-use-b60c0cb8f67d745626fec6f0c8540818f24e91a6.tar.bz2
drakx-backup-do-not-use-b60c0cb8f67d745626fec6f0c8540818f24e91a6.tar.xz
drakx-backup-do-not-use-b60c0cb8f67d745626fec6f0c8540818f24e91a6.zip
move to MDK::Common, bool->to_bool
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r--perl-install/printer.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 8eea04aa8..0df3639ac 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw(%thedb %thedb_gsdriver %printer_type %printer_type_inv @papersize_type %fields @entries_db_short @entry_db_description %descr_to_help %descr_to_db %db_to_descr %descr_to_ppd);
-use common qw(:common :system :file);
+use common;
use commands;
use run_program;
'#n169'>169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
/*
 * Guillaume Cottenceau (gc@mandrakesoft.com)
 *
 * Copyright 2000 MandrakeSoft
 *
 * This software may be freely redistributed under the terms of the GNU
 * public license.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

/* Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.23.tar.bz2
 *
 *   Licence of this code follows:

    PCMCIA controller probe

    probe.c 1.52 2000/06/12 21:33:02

    The contents of this file are subject to the Mozilla Public
    License Version 1.1 (the "License"); you may not use this file
    except in compliance with the License. You may obtain a copy of
    the License at http://www.mozilla.org/MPL/

    Software distributed under the License is distributed on an "AS
    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
    implied. See the License for the specific language governing
    rights and limitations under the License.

    The initial developer of the original code is David A. Hinds
    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.

    Alternatively, the contents of this file may be used under the
    terms of the GNU Public License version 2 (the "GPL"), in which
    case the provisions of the GPL are applicable instead of the
    above.  If you wish to allow the use of your version of this file
    only under the terms of the GPL and not to allow others to use
    your version of this file under the MPL, indicate your decision
    by deleting the provisions above and replace them with the notice
    and other provisions required by the GPL.  If you do not delete
    the provisions above, a recipient may use your version of this
    file under either the MPL or the GPL.
    
======================================================================*/

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

#include <pcmcia/config.h>

#include "../log.h"
#include "pcmcia.h"

/*====================================================================*/

typedef struct {
	u_short	vendor, device;
	char	*tag;
	char	*name;
} pci_id_t;

pci_id_t pci_id[] = {
	{ 0x1013, 0x1100, "Cirrus Logic CL 6729", "Cirrus PD6729" },
	{ 0x1013, 0x1110, "Cirrus Logic PD 6832", "Cirrus PD6832" },
	{ 0x10b3, 0xb106, "SMC 34C90", "SMC 34C90" },
	{ 0x1180, 0x0465, "Ricoh RL5C465", "Ricoh RL5C465" },
	{ 0x1180, 0x0466, "Ricoh RL5C466", "Ricoh RL5C466" },
	{ 0x1180, 0x0475, "Ricoh RL5C475", "Ricoh RL5C475" },
	{ 0x1180, 0x0476, "Ricoh RL5C476", "Ricoh RL5C476" },
	{ 0x1180, 0x0478, "Ricoh RL5C478", "Ricoh RL5C478" },
	{ 0x104c, 0xac12, "Texas Instruments PCI1130", "TI 1130" },
	{ 0x104c, 0xac13, "Texas Instruments PCI1031", "TI 1031" },
	{ 0x104c, 0xac15, "Texas Instruments PCI1131", "TI 1131" },
	{ 0x104c, 0xac16, "Texas Instruments PCI1250", "TI 1250A" },
	{ 0x104c, 0xac17, "Texas Instruments PCI1220", "TI 1220" },
	{ 0x104c, 0xac19, "Texas Instruments PCI1221", "TI 1221" },
	{ 0x104c, 0xac1a, "Texas Instruments PCI1210", "TI 1210" },
	{ 0x104c, 0xac1d, "Texas Instruments PCI1251A", "TI 1251A" },
	{ 0x104c, 0xac1f, "Texas Instruments PCI1251B", "TI 1251B" },
	{ 0x104c, 0xac1b, "Texas Instruments PCI1450", "TI 1450" },
	{ 0x104c, 0xac1c, "Texas Instruments PCI1225", "TI 1225" },
	{ 0x104c, 0xac1e, "Texas Instruments PCI1211", "TI 1211" },
	{ 0x104c, 0xac50, "Texas Instruments PCI1410", "TI 1410" },
	{ 0x104c, 0xac51, "Texas Instruments PCI1420", "TI 1420" },
	{ 0x1217, 0x6729, "O2 Micro 6729", "O2Micro OZ6729" },
	{ 0x1217, 0x673a, "O2 Micro 6730", "O2Micro OZ6730" },
	{ 0x1217, 0x6832, "O2 Micro 6832/6833", "O2Micro OZ6832/OZ6833" },
	{ 0x1217, 0x6836, "O2 Micro 6836/6860", "O2Micro OZ6836/OZ6860" },
	{ 0x1217, 0x6872, "O2 Micro 6812", "O2Micro OZ6812" },
	{ 0x1179, 0x0603, "Toshiba ToPIC95-A", "Toshiba ToPIC95-A" },
	{ 0x1179, 0x060a, "Toshiba ToPIC95-B", "Toshiba ToPIC95-B" },
	{ 0x1179, 0x060f, "Toshiba ToPIC97", "Toshiba ToPIC97" },
	{ 0x1179, 0x0617, "Toshiba ToPIC100", "Toshiba ToPIC100" },
	{ 0x119b, 0x1221, "Omega Micro 82C092G", "Omega Micro 82C092G" },
	{ 0x8086, 0x1221, "Intel 82092AA", "Intel 82092AA" }
};
#define PCI_COUNT (sizeof(pci_id)/sizeof(pci_id_t))

static int pci_probe(void)
{
	char s[256], *name = NULL;
	u_int device, vendor, i;
	FILE *f;
    
	log_message("PCMCIA: probing PCI bus..");

	f = fopen("/proc/bus/pci/devices", "r");

	if (!f) {
		log_message("where are you going without /proc/bus/pci/devices ??");
		return -1;
	}

	while (fgets(s, 256, f) != NULL) {
		u_int n = strtoul(s+5, NULL, 16);
		vendor = (n >> 16); device = (n & 0xffff);
		for (i = 0; i < PCI_COUNT; i++)
			if ((vendor == pci_id[i].vendor) &&
			    (device == pci_id[i].device)) break;
		if (i < PCI_COUNT) {
			name = pci_id[i].name;
			break;
		}
	}

	fclose(f);
    
	if (name) {
		log_message("\t%s found, 2 sockets.", name);
		return 0;
	} else {
		log_message("\tnot found.");
		return -ENODEV;
	}
}

/*====================================================================*/

#include <sys/io.h>
typedef u_short ioaddr_t;

#include "i82365.h"
#include "cirrus.h"
#include "vg468.h"

static ioaddr_t i365_base = 0x03e0;

static u_char i365_get(u_short sock, u_short reg)
{
	u_char val = I365_REG(sock, reg);
	outb(val, i365_base); val = inb(i365_base+1);
	return val;
}

static void i365_set(u_short sock, u_short reg, u_char data)
{
	u_char val = I365_REG(sock, reg);
	outb(val, i365_base); outb(data, i365_base+1);
}

static void i365_bset(u_short sock, u_short reg, u_char mask)
{
	u_char d = i365_get(sock, reg);
	d |= mask;
	i365_set(sock, reg, d);
}

static void i365_bclr(u_short sock, u_short reg, u_char mask)
{
	u_char d = i365_get(sock, reg);
	d &= ~mask;
	i365_set(sock, reg, d);
}

static int i365_probe(void)
{
	int val, sock, done;
	char *name = "i82365sl";