From 14ee35611d2d24426787e80a27a65e51273de41d Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 10 Feb 2004 17:08:37 +0000 Subject: floppy_device returns first floppy device, look for medias first in case of usb floppies (maybe ide floppies also? never tested) then regular floppy drive --- mdk-stage1/tools.c | 14 +++++++++++++- mdk-stage1/tools.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 7724c6e72..e3a0fa479 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -42,7 +42,8 @@ #include "automatic.h" #include "tools.h" - +#include "probing.h" +#include "modules.h" static struct param_elem params[50]; static int param_number = 0; @@ -476,6 +477,17 @@ int kernel_version(void) return charstar_to_int(val.release + 2); } +char * floppy_device(void) +{ + char ** names, ** models; + my_insmod("sd_mod", ANY_DRIVER_TYPE, NULL, 0); + get_medias(FLOPPY, &names, &models, BUS_ANY); + if (names && *names) + return asprintf_("/dev/%s", *names); + else + return "/dev/fd0"; +} + char * asprintf_(const char *msg, ...) { int n; diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h index be3883eb5..3b95a2f26 100644 --- a/mdk-stage1/tools.h +++ b/mdk-stage1/tools.h @@ -43,6 +43,7 @@ char ** grab_env(void); char ** list_directory(char * direct); int string_array_length(char ** a); int kernel_version(void); +char * floppy_device(void); char * asprintf_(const char *msg, ...); int scall_(int retval, char * msg, char * file, int line); #define scall(retval, msg) scall_(retval, msg, __FILE__, __LINE__) -- cgit v1.2.1