summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/draksplash
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-03-08 09:07:37 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-03-08 09:07:37 +0000
commitc75cce01d211b14dcee58bf8698f55a63442c5e8 (patch)
tree2bbb30f537ba47d4d359672d4ada33e048a1d1c2 /perl-install/standalone/draksplash
parent931516378d99fe8cebd16fbf797219e6ce7e4b09 (diff)
downloaddrakx-c75cce01d211b14dcee58bf8698f55a63442c5e8.tar
drakx-c75cce01d211b14dcee58bf8698f55a63442c5e8.tar.gz
drakx-c75cce01d211b14dcee58bf8698f55a63442c5e8.tar.bz2
drakx-c75cce01d211b14dcee58bf8698f55a63442c5e8.tar.xz
drakx-c75cce01d211b14dcee58bf8698f55a63442c5e8.zip
fix spacing around commas (sanitizing)
Diffstat (limited to 'perl-install/standalone/draksplash')
-rwxr-xr-xperl-install/standalone/draksplash62
1 files changed, 31 insertions, 31 deletions
diff --git a/perl-install/standalone/draksplash b/perl-install/standalone/draksplash
index 1455266b1..359568e6a 100755
--- a/perl-install/standalone/draksplash
+++ b/perl-install/standalone/draksplash
@@ -41,14 +41,14 @@ my %theme = ('name' => 'new_theme',
'w' => '800',
},
'boot_conf' => {
- 'tx' => 0 ,
- 'ty' => 0 ,
- 'tw' => 0 ,
- 'th' => 0 ,
- 'px' => 0 ,
- 'py' => 0 ,
- 'pw' => 0 ,
- 'ph' => 0 ,
+ 'tx' => 0,
+ 'ty' => 0,
+ 'tw' => 0,
+ 'th' => 0,
+ 'px' => 0,
+ 'py' => 0,
+ 'pw' => 0,
+ 'ph' => 0,
'pc' => '0x21459d',
},
'boot_img' => ''
@@ -78,7 +78,7 @@ my %first = ('frame' => Gtk2::Frame->new(N("first step creation")),
},
'combo' => {
'res' => ['800x600', '1024x768', '1280x1024'],
- 'name' => [ $theme{name} , giv_exist_thm() ]
+ 'name' => [ $theme{name}, giv_exist_thm() ]
},
extras => {
res => {
@@ -125,26 +125,26 @@ my %boot_conf_frame = ('frame' => Gtk2::Frame->new(N("Configure bootsplash pictu
'quiet' => N("Make kernel message quiet by default"),
},
},
- 'pos' => [ 'tx 1' ,
- 'ty 1' ,
- 'tw 1' ,
- 'th 1' ,
- 'px 1' ,
- 'py 1' ,
- 'pw 1' ,
- 'ph 1' ,
- 'pc' ,
+ 'pos' => [ 'tx 1',
+ 'ty 1',
+ 'tw 1',
+ 'th 1',
+ 'px 1',
+ 'py 1',
+ 'pw 1',
+ 'ph 1',
+ 'pc',
'logo',
'quiet',
'annul',
'prev',
- 'save' ,
+ 'save',
'kill',
],
);
#- var action is used to hide/show the correct frame
-my $VB2 = Gtk2::VBox->new(0,5);
-my $first_vbox = Gtk2::VBox->new(0,5);
+my $VB2 = Gtk2::VBox->new(0, 5);
+my $first_vbox = Gtk2::VBox->new(0, 5);
&mk_frame($VB2, \%first);
#****************************- Signal event actions
@@ -263,13 +263,13 @@ LOGO_CONSOLE='.$logo.'
# Make kernel message quiet by default.
QUIET='.$quiet;
output($globalconf_file, $globalconf_cont);
- output($cfg_file,$cfg_cont);
+ output($cfg_file, $cfg_cont);
}
#- Desc => read the current bootsplash theme configuration if exist
sub get_this_thm_res_conf() {
- member($first{widgets}{combo}{name}->entry->get_text , giv_exist_thm())
+ member($first{widgets}{combo}{name}->entry->get_text, giv_exist_thm())
and $theme{name} = $first{widgets}{combo}{name}->entry->get_text
and thm_in_this_res(1)
and read_boot_conf();
@@ -283,7 +283,7 @@ sub read_boot_conf {
my $line;
if (-f $theme{name}.'/cfg/bootsplash-'.$theme{res}{res}.'.cfg') {
local *CFG;
- open CFG , $theme{name}.'/cfg/bootsplash-'.$theme{res}{res}.'.cfg';
+ open CFG, $theme{name}.'/cfg/bootsplash-'.$theme{res}{res}.'.cfg';
while ($line = <CFG>) {
$line =~ m/^([a-z][a-z])=([^\n]+)/
and $theme{boot_conf}{$1} = $2;
@@ -354,7 +354,7 @@ sub show_act {
#- Desc => just add tooltips
#- Args => name of widget(str) and frame to work on it (\%hash)
sub tool_tip {
- my ($name , $ref) = @_;
+ my ($name, $ref) = @_;
foreach (keys %{$ref->{widget}}) {
$_ eq 'tooltip' and next;
if ($ref->{widget}{$_}{$name}) {
@@ -370,7 +370,7 @@ my %hboxes;
#- Args => $box(a Vbox widget to contain all widgets), \%frame (hash with complete definition of the frame)
#- Return=> all hash{widgets} are created and packed in $box
sub mk_frame {
- my ($box , $ref) = @_;
+ my ($box, $ref) = @_;
foreach my $pos (@{$ref->{pos}}) {
my $key = $1.'hb' if $pos =~ m/^(\w+)(\s+)?(\w+)?$/;
#- open a new hbox
@@ -425,12 +425,12 @@ sub dec2hex {
#- Desc => prepare and set all signal_connect for boot_frame widget
sub make_boot_frame() {
- my $VB = Gtk2::VBox->new(0,5);
+ my $VB = Gtk2::VBox->new(0, 5);
&mk_frame($VB, \%boot_conf_frame);
#- open a color choose box
$boot_conf_frame{widgets}{button}{pc}->signal_connect(clicked => sub {
my $color = gtkshow(Gtk2::ColorSelectionDialog->new(N("ProgressBar color selection")));
- my @rgb = map { hex($_)/255 } ($1 ,$2, $3) if $theme{boot_conf}{pc} =~ m/0x(.{2})(.{2})(.{2})/;
+ my @rgb = map { hex($_)/255 } ($1, $2, $3) if $theme{boot_conf}{pc} =~ m/0x(.{2})(.{2})(.{2})/;
$color->colorsel->set_current_color(Gtk2::Gdk::Color->new(@rgb));
$color->cancel_button->signal_connect(clicked => sub { $color->destroy });
$color->ok_button->signal_connect(clicked => sub {
@@ -462,7 +462,7 @@ sub make_boot_frame() {
my $prog_tl_y = $theme{boot_conf}{py};
my $prog_width = $theme{boot_conf}{pw};
my $prog_height = $theme{boot_conf}{ph};
- show_prev($txt_tl_x,$txt_tl_y,$txt_width,$txt_height,$prog_tl_x,$prog_tl_y,$prog_width,$prog_height);
+ show_prev($txt_tl_x, $txt_tl_y, $txt_width, $txt_height, $prog_tl_x, $prog_tl_y, $prog_width, $prog_height);
});
$boot_conf_frame{frame}->show_all;
# - check scales values are possibly correct
@@ -508,8 +508,8 @@ sub show_prev {
my ($w, $event) = @_;
my ($x, $y, $width, $height) = $event->area->values;
$prev_pic->render_to_drawable($w->window, $w->style->fg_gc('normal'), $x, $y, $x, $y, $width, $height, 'normal', 0, 0);
- $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true,$txt_tl_x, $txt_tl_y,$txt_width,$txt_height);
- $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true, $prog_tl_x,$prog_tl_y,$prog_width, $prog_height);
+ $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true, $txt_tl_x, $txt_tl_y, $txt_width, $txt_height);
+ $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true, $prog_tl_x, $prog_tl_y, $prog_width, $prog_height);
});
$prev_window->signal_connect(delete_event => \&kill_preview);
$prev_window->show_all;
ref='#n476'>476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933
/*
 * 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.
 *
 */

/*
 * Portions from Erik Troan (ewt@redhat.com)
 *
 * Copyright 1996 Red Hat Software 
 *
 */


/*
 * This contains stuff related to probing:
 * (1) any (actually only SCSI, NET, CPQ, USB Controllers) devices (autoprobe for PCI and USB)
 * (2) IDE media
 * (3) SCSI media
 * (4) ETH devices
 */


#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <pci/pci.h>
#include "stage1.h"

#include "log.h"
#include "frontend.h"
#include "modules.h"
#include "pci-resource/pci-ids.h"
#ifdef ENABLE_USB
#include "usb-resource/usb-ids.h"
#endif

#include "probing.h"


struct media_info {
	char * name;
	char * model;
	enum media_type type;
};


static void warning_insmod_failed(enum insmod_return r)
{
	if (IS_AUTOMATIC && r == INSMOD_FAILED_FILE_NOT_FOUND)
		return;
	if (r != INSMOD_OK) {
		if (r == INSMOD_FAILED_FILE_NOT_FOUND)
			stg1_error_message("This floppy doesn't contain the driver.");
		else
			stg1_error_message("Warning, installation of driver failed. (please include msg from <Alt-F3> for bugreports)");
	}
}

#ifndef DISABLE_NETWORK
struct net_description_elem
{
	char * intf_name;
	char * intf_description;
};
static struct net_description_elem net_descriptions[50];
static int net_descr_number = 0;
static char * intf_descr_for_discover = NULL;
static char * net_intf_too_early_name[50]; /* for modules providing more than one net intf */
static int net_intf_too_early_number = 0;
static int net_intf_too_early_ptr = 0;

void prepare_intf_descr(const char * intf_descr)
{
	intf_descr_for_discover = strdup(intf_descr);
}

void net_discovered_interface(char * intf_name)
{
	if (!intf_descr_for_discover) {
		net_intf_too_early_name[net_intf_too_early_number++] = strdup(intf_name);
		return;
	}
	if (!intf_name) {
		if (net_intf_too_early_ptr >= net_intf_too_early_number) {
			log_message("NET: was expecting another network interface (broken net module?)");
			return;
		}
		net_descriptions[net_descr_number].intf_name = net_intf_too_early_name[net_intf_too_early_ptr++];
	}
	else
		net_descriptions[net_descr_number].intf_name = strdup(intf_name);
	net_descriptions[net_descr_number].intf_description = strdup(intf_descr_for_discover);
	intf_descr_for_discover = NULL;
	net_descr_number++;
}

char * get_net_intf_description(char * intf_name)
{
	int i;
	for (i = 0; i < net_descr_number ; i++)
		if (!strcmp(net_descriptions[i].intf_name, intf_name))
			return net_descriptions[i].intf_description;
	return strdup("unknown");
}
#endif

struct pcitable_entry detected_devices[50];
int detected_devices_len = 0;

/* FIXME: factorize with probe_that_type() */

static void add_detected_device(unsigned short vendor, unsigned short device, const char *name, const char *module)
{
	struct pcitable_entry *dev = &detected_devices[detected_devices_len++];
	dev->vendor = vendor;
	dev->device = device;
	strncpy(dev->module, module, 19);
	dev->module[19] = '\0';
	strncpy(dev->description, name, 99);
	dev->description[99] = '\0';
	log_message("detected device (%x, %x, %s, %s)", vendor, device, name, module);
}

static int check_device_full(struct pci_module_map_full * pcidb_full, unsigned int len_full,
			     unsigned short vendor, unsigned short device,
			     unsigned short subvendor, unsigned short subdevice)
{
	int i;
	for (i = 0; i < len_full; i++)
		if (pcidb_full[i].vendor == vendor && pcidb_full[i].device == device) {
			if (pcidb_full[i].subvendor == subvendor && pcidb_full[i].subdevice == subdevice) {
				add_detected_device(pcidb_full[i].vendor, pcidb_full[i].device,
						    pcidb_full[i].name, pcidb_full[i].module);
				return 1;
			}
		}
	return 0;
}

static int check_device(struct pci_module_map * pcidb, unsigned int len,
			unsigned short vendor, unsigned short device) {
	int i;
	for (i = 0; i < len; i++)
		if (pcidb[i].vendor == vendor && pcidb[i].device == device) {
			add_detected_device(pcidb[i].vendor, pcidb[i].device,
					    pcidb[i].name, pcidb[i].module);
			return 1;
		}
	return 0;
}

void probing_detect_devices()
{
	FILE * f = NULL;
	char buf[200];
        static int already_detected_devices = 0;

	if (already_detected_devices)
		return;

	if (!(f = fopen("/proc/bus/pci/devices", "rb"))) {
		log_message("PCI: could not open proc file");
		return;
	}

	while (1) {
		unsigned int i;
		unsigned short vendor, device, subvendor, subdevice, devbusfn;
		if (!fgets(buf, sizeof(buf), f)) break;
		sscanf(buf, "%hx %x", &devbusfn, &i);
		device = i;
		vendor = i >> 16;
		{
			int bus = devbusfn >> 8;
			int device_p = (devbusfn & 0xff) >> 3;
			int function = (devbusfn & 0xff) & 0x07;
			char file[100];
			int sf;
			sprintf(file, "/proc/bus/pci/%02x/%02x.%d", bus, device_p, function);
			if ((sf = open(file, O_RDONLY)) == -1) {
				log_message("PCI: could not open file for full probe (%s)", file);
				continue;
			}
			if (read(sf, buf, 48) == -1) {
				log_message("PCI: could not read 48 bytes from %s", file);
				close(sf);
				continue;
			}
			close(sf);
			memcpy(&subvendor, buf+44, 2);
			memcpy(&subdevice, buf+46, 2);
		}


#ifndef DISABLE_PCIADAPTERS
#ifndef DISABLE_MEDIAS
		if (check_device_full(medias_pci_ids_full, medias_num_ids_full, vendor, device, subvendor, subdevice))
			continue;
		if (check_device(medias_pci_ids, medias_num_ids, vendor, device))
			continue;
#endif

#ifndef DISABLE_NETWORK
		if (check_device_full(network_pci_ids_full, network_num_ids_full, vendor, device, subvendor, subdevice))
			continue;
		if (check_device(network_pci_ids, network_num_ids, vendor, device))
			continue;
#endif
#endif

#ifdef ENABLE_USB
		if (check_device(usb_pci_ids, usb_num_ids, vendor, device))
			continue;
#endif

		/* device can't be found in built-in pcitables, but keep it */
		add_detected_device(vendor, device, "", "");
	}

	fclose(f);
	already_detected_devices = 1;
}

#ifndef DISABLE_MEDIAS
static const char * get_alternate_module(const char * name)
{
	struct alternate_mapping {
		const char * a;
		const char * b;
	};
	static struct alternate_mapping mappings[] = {
                { "ahci", "ata_piix" },
        };
	int mappings_nb = sizeof(mappings) / sizeof(struct alternate_mapping);
        int i;

	for (i=0; i<mappings_nb; i++) {
		const char * alternate = NULL;
		if (streq(name, mappings[i].a))
			alternate = mappings[i].b;
		else if (streq(name, mappings[i].b))
			alternate = mappings[i].a;
		if (alternate) {
			log_message("found alternate module %s for driver %s", alternate, name);
			return alternate;
		}
	}
        return NULL;
}
#endif

void discovered_device(enum driver_type type,
		       unsigned short vendor, unsigned short device, unsigned short subvendor, unsigned short subdevice,
		       const char * description, const char * driver)
{
	enum insmod_return failed = INSMOD_FAILED;
	log_message("PCI: device %04x %04x %04x %04x is \"%s\", driver is %s", vendor, device, subvendor, subdevice, description, driver);
#ifndef DISABLE_MEDIAS
	if (type == SCSI_ADAPTERS) {
		const char * alternate = NULL;
		wait_message("Loading driver for SCSI adapter:\n \n%s", description);
		failed = my_insmod(driver, SCSI_ADAPTERS, NULL, 1);
		alternate = get_alternate_module(driver);
		if (!IS_NOAUTO && alternate) {
			failed = failed || my_insmod(alternate, SCSI_ADAPTERS, NULL, 1);
		}
		remove_wait_message();
		warning_insmod_failed(failed);
	}
#endif
#ifndef DISABLE_NETWORK
	if (type == NETWORK_DEVICES) {
		wait_message("Loading driver for network device:\n \n%s", description);
		prepare_intf_descr(description);
		failed = my_insmod(driver, NETWORK_DEVICES, NULL, 1);
		warning_insmod_failed(failed);
		remove_wait_message();
		if (intf_descr_for_discover) /* for modules providing more than one net intf */
			net_discovered_interface(NULL);
	}
#endif
#ifdef ENABLE_USB
	if (type == USB_CONTROLLERS)
                /* we can't allow additional modules floppy since we need usbkbd for keystrokes of usb keyboards */
		failed = my_insmod(driver, USB_CONTROLLERS, NULL, 0);
#endif
}

#ifdef ENABLE_USB
void probe_that_type(enum driver_type type, enum media_bus bus)
#else
void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((unused)))
#endif
{
        static int already_probed_usb_controllers = 0;
        static int already_loaded_usb_scsi = 0;

	/* ---- PCI probe ---------------------------------------------- */
	{
		FILE * f = NULL;
		unsigned int len = 0;
		unsigned int len_full = 0;
		char buf[200];
		struct pci_module_map * pcidb = NULL;
		struct pci_module_map_full * pcidb_full = NULL;

		switch (type) {
#ifndef DISABLE_PCIADAPTERS
#ifndef DISABLE_MEDIAS
			static int already_probed_scsi_adapters = 0;
		case SCSI_ADAPTERS:
			if (already_probed_scsi_adapters)
				goto end_pci_probe;
			already_probed_scsi_adapters = 1;
			pcidb = medias_pci_ids;
			len   = medias_num_ids;
			pcidb_full = medias_pci_ids_full;
			len_full   = medias_num_ids_full;
			break;
#endif
#ifndef DISABLE_NETWORK
		case NETWORK_DEVICES:
			pcidb = network_pci_ids;
			len   = network_num_ids;
			pcidb_full = network_pci_ids_full;
			len_full   = network_num_ids_full;
			break;
#endif
#endif
#ifdef ENABLE_USB
		case USB_CONTROLLERS:
			if (already_probed_usb_controllers || IS_NOAUTO)
				goto end_pci_probe;
			already_probed_usb_controllers = 1;
			pcidb = usb_pci_ids;
			len   = usb_num_ids;
			break;
#endif
		default:
			goto end_pci_probe;
		}

		if (!(f = fopen("/proc/bus/pci/devices", "rb"))) {
			log_message("PCI: could not open proc file");
			goto end_pci_probe;
		}

		while (1) {
			unsigned int i;
			unsigned short vendor, device, subvendor, subdevice, class_, devbusfn;
			unsigned char class_prog;
			const char *name, *module;
			enum driver_type type_ = type;

			if (!fgets(buf, sizeof(buf), f)) break;
	
			sscanf(buf, "%hx %x", &devbusfn, &i);
			device = i;
			vendor = i >> 16;

			{
				int bus = devbusfn >> 8;
				int device_p = (devbusfn & 0xff) >> 3;
				int function = (devbusfn & 0xff) & 0x07;
				char file[100];
				int sf;
				sprintf(file, "/proc/bus/pci/%02x/%02x.%d", bus, device_p, function);
				if ((sf = open(file, O_RDONLY)) == -1) {
					log_message("PCI: could not open file for full probe (%s)", file);
					continue;
				}
				if (read(sf, buf, 48) == -1) {
					log_message("PCI: could not read 48 bytes from %s", file);
					close(sf);
					continue;
				}
				close(sf);
				memcpy(&class_prog, buf+9, 1);
				memcpy(&class_, buf+10, 2);
				memcpy(&subvendor, buf+44, 2);
				memcpy(&subdevice, buf+46, 2);
			}

			/* special rules below must be in sync with ldetect/pci.c */

			if (class_ == PCI_CLASS_SERIAL_USB) {
				/* taken from kudzu's pci.c */
				module = 
					class_prog == 0 ? "usb-uhci" : 
					class_prog == 0x10 ? "usb-ohci" :
					class_prog == 0x20 ? "ehci-hcd" : NULL;
				if (module) {
					name = "USB Controller";
					type_ = USB_CONTROLLERS;
					goto found_pci_device;
				}
			}
			if (class_ == PCI_CLASS_SERIAL_FIREWIRE) {
				/* taken from kudzu's pci.c */
				if (class_prog == 0x10) {
					module = strdup("ohci1394");
					name = "Firewire Controller";
					goto found_pci_device;
				}
			}

			for (i = 0; i < len_full; i++)
				if (pcidb_full[i].vendor == vendor && pcidb_full[i].device == device) {
					if (pcidb_full[i].subvendor == subvendor && pcidb_full[i].subdevice == subdevice) {
						name = pcidb_full[i].name;
						module = pcidb_full[i].module;
						goto found_pci_device;
					}
				}
			
			for (i = 0; i < len; i++)
				if (pcidb[i].vendor == vendor && pcidb[i].device == device) {
					name = pcidb[i].name;
					module = pcidb[i].module;
					goto found_pci_device;
				}

			continue;

		found_pci_device:
			discovered_device(type_, vendor, device, subvendor, subdevice, name, module);
		}
	end_pci_probe:;
		if (f)
                        fclose(f);
	}


#ifdef ENABLE_USB
	/* ---- USB probe ---------------------------------------------- */
	if ((bus == BUS_USB || bus == BUS_ANY) && !(IS_NOAUTO)) {
		static int already_mounted_usbdev = 0;

		FILE * f = NULL;
		int len = 0;
		char buf[200];
		struct usb_module_map * usbdb = NULL;

		if (!already_probed_usb_controllers) {
			already_probed_usb_controllers = 1;
			probe_that_type(USB_CONTROLLERS, BUS_ANY);
		}

		if (!already_mounted_usbdev) {
			already_mounted_usbdev = 1;
			if (mount("none", "/proc/bus/usb", "usbfs", 0, NULL) &&
			    mount("none", "/proc/bus/usb", "usbdevfs", 0, NULL)) {
				log_message("USB: couldn't mount /proc/bus/usb");
				goto end_usb_probe;
			}
			wait_message("Detecting USB devices.");
			sleep(4); /* sucking background work */
			my_insmod("usbkbd", ANY_DRIVER_TYPE, NULL, 0);
			my_insmod("keybdev", ANY_DRIVER_TYPE, NULL, 0);
			remove_wait_message();
		}

		if (!(f = fopen("/proc/bus/usb/devices", "rb"))) {
			log_message("USB: could not open proc file");
			goto end_usb_probe;
		}

		switch (type) {
		case NETWORK_DEVICES:
			usbdb = usb_usb_ids;
			len   = usb_usb_num_ids;
			break;
		default:
			goto end_usb_probe;
		}

		while (1) {
			int i, vendor, id;

			if (!fgets(buf, sizeof(buf), f)) break;

			if (sscanf(buf, "P:  Vendor=%x ProdID=%x", &vendor, &id) != 2)
				continue;

			for (i = 0; i < len; i++) {
				if (usbdb[i].vendor == vendor && usbdb[i].id == id) {
					log_message("USB: device %04x %04x is \"%s\" (%s)", vendor, id, usbdb[i].name, usbdb[i].module);
#ifndef DISABLE_NETWORK
					if (type == NETWORK_DEVICES) {
						stg1_info_message("About to load driver for usb network device:\n \n%s", usbdb[i].name);
						prepare_intf_descr(usbdb[i].name);
						warning_insmod_failed(my_insmod(usbdb[i].module, NETWORK_DEVICES, NULL, 1));
						if (intf_descr_for_discover) /* for modules providing more than one net intf */
							net_discovered_interface(NULL);
					}
#endif

				}
			}
		}
	end_usb_probe:;
		if (f)
                        fclose(f);
	}
#endif

        /* be sure to load usb-storage after SCSI adapters, so that they are in
           same order than reboot, so that naming is the same */
        if (type == SCSI_ADAPTERS && already_probed_usb_controllers && !already_loaded_usb_scsi) {
                already_loaded_usb_scsi = 1;
                /* we can't allow additional modules floppy since we need usbkbd for keystrokes of usb keyboards */
                my_insmod("usb-storage", SCSI_ADAPTERS, NULL, 0); 
                if (module_already_present("ieee1394"))
                        my_insmod("sbp2", SCSI_ADAPTERS, NULL, 0);
                wait_message("Detecting USB mass-storage devices.");
                sleep(10); /* sucking background work */
                remove_wait_message();
        }
}


static struct media_info * medias = NULL;

static void find_media(enum media_bus bus)
{
    	char b[50];
	char buf[5000];
	struct media_info tmp[50];
	int count = 0;
        int fd;

	if (medias)
		free(medias); /* that does not free the strings, by the way */

	if (bus == BUS_SCSI || bus == BUS_USB || bus == BUS_ANY) {
                log_message("looking for SCSI adapters");
                probe_that_type(SCSI_ADAPTERS, bus);
        }
	/* ----------------------------------------------- */
	if (bus != BUS_IDE && bus != BUS_ANY)
		goto find_media_after_ide;
	log_message("looking for ide media");

    	strcpy(b, "/proc/ide/hd");
    	for (b[12] = 'a'; b[12] <= 't'; b[12]++) {