FreeBSD/sys/dev/ppbus/ppbconf.c
/*
 * ppb_scan_bus()
 *
 * Scan the ppbus for IEEE1284 compliant devices
 */
ppb_scan_bus()
Scan the ppbus for IEEE1284 compliant devices
ppb_scan_bus () Scan the ppbus for IEEE1284 compliant devices
static int
ppb_scan_bus(device_t bus)
{
	struct ppb_data * ppb = (struct ppb_data *)device_get_softc(bus);
	int error = 0;
	error = ppb_1284_negociate(bus, PPB_NIBBLE, PPB_REQUEST_ID);
	if ((ppb->state == PPB_ERROR) && (ppb->error == PPB_NOT_IEEE1284))
		goto end_scan;
	ppb_1284_terminate(bus);
	device_printf(bus, "IEEE1284 device found ");
	if (!(error = ppb_1284_negociate(bus, PPB_NIBBLE, 0))) {
		printf("/NIBBLE");
		ppb_1284_terminate(bus);
	}
	if (!(error = ppb_1284_negociate(bus, PPB_PS2, 0))) {
		printf("/PS2");
		ppb_1284_terminate(bus);
	}
	if (!(error = ppb_1284_negociate(bus, PPB_ECP, 0))) {
		printf("/ECP");
		ppb_1284_terminate(bus);
	}
	if (!(error = ppb_1284_negociate(bus, PPB_ECP, PPB_USE_RLE))) {
		printf("/ECP_RLE");
		ppb_1284_terminate(bus);
	}
	if (!(error = ppb_1284_negociate(bus, PPB_EPP, 0))) {
		printf("/EPP");
		ppb_1284_terminate(bus);
	}
	if (bootverbose) {
		if (!(error = ppb_1284_negociate(bus, PPB_NIBBLE,
				PPB_REQUEST_ID))) {
			printf("/NIBBLE_ID");
			ppb_1284_terminate(bus);
		}
		if (!(error = ppb_1284_negociate(bus, PPB_PS2,
				PPB_REQUEST_ID))) {
			printf("/PS2_ID");
			ppb_1284_terminate(bus);
		}
		if (!(error = ppb_1284_negociate(bus, PPB_ECP,
				PPB_REQUEST_ID))) {
			printf("/ECP_ID");
			ppb_1284_terminate(bus);
		}
		if (!(error = ppb_1284_negociate(bus, PPB_ECP,
				PPB_REQUEST_ID | PPB_USE_RLE))) {
			printf("/ECP_RLE_ID");
			ppb_1284_terminate(bus);
		}
		if (!(error = ppb_1284_negociate(bus, PPB_COMPATIBLE,
				PPB_EXTENSIBILITY_LINK))) {
			printf("/Extensibility Link");
			ppb_1284_terminate(bus);
		}
	}
	printf("\n");
	ppb->class_id = ppb_pnp_detect(bus);
	return (0);
end_scan:
	return (error);
}
static int ppb_scan_bus ( device_t bus ) { struct ppb_data * ppb = ( struct ppb_data * ) device_get_softc ( bus ) ; int error = 0 ; error = ppb_1284_negociate ( bus , PPB_NIBBLE , PPB_REQUEST_ID ) ; if ( ( ppb -> state == PPB_ERROR ) && ( ppb -> error == PPB_NOT_IEEE1284 ) ) goto end_scan ; ppb_1284_terminate ( bus ) ; device_printf ( bus , " " ) ; if ( ! ( error = ppb_1284_negociate ( bus , PPB_NIBBLE , 0 ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_PS2 , 0 ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_ECP , 0 ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_ECP , PPB_USE_RLE ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_EPP , 0 ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( bootverbose ) { if ( ! ( error = ppb_1284_negociate ( bus , PPB_NIBBLE , PPB_REQUEST_ID ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_PS2 , PPB_REQUEST_ID ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_ECP , PPB_REQUEST_ID ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_ECP , PPB_REQUEST_ID | PPB_USE_RLE ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } if ( ! ( error = ppb_1284_negociate ( bus , PPB_COMPATIBLE , PPB_EXTENSIBILITY_LINK ) ) ) { printf ( " " ) ; ppb_1284_terminate ( bus ) ; } } printf ( " \n " ) ; ppb -> class_id = ppb_pnp_detect ( bus ) ; return ( 0 ) ; end_scan : return ( error ) ; }
ppb_scan_bus()
 Scan the ppbus for IEEE1284 compliant devices
ppb_scan_bus () Scan the ppbus for IEEE1284 compliant devices
/* try all IEEE1284 modes, for one device only
	 *
	 * XXX We should implement the IEEE1284.3 standard to detect
	 * daisy chained devices
	 */ /* try more IEEE1284 modes */ /* detect PnP devices */