From: [RSU]The_Assassin|BuF <the...@zi...> - 2002-03-27 19:19:32
|
Small patch for /dev filesystem support. It scans the /dev/cdroms and /dev/floppy folders for devices, instead of just assuming /dev/fd*u1440 and /dev/cdrom are available. Tried to stick to your coding style as much as possible. ;) Delete the printf()s and/or the serial configs if you want, not really necessary. Devfs support in other files isn't really usefull ATM IMO, because right now most distributions even using devfs make symlinks from the old device names anyways. Maybe when it's out of expirimental stage... --- ./BasiliskII/src/Unix/sys_unix.cpp Wed Mar 20 20:03:42 2002 +++ ./BasiliskII/src/Unix/sys_unix.cpp Wed Mar 27 19:04:22 2002 @@ -31,6 +31,7 @@ #include <linux/major.h> #include <linux/kdev_t.h> #include <linux/unistd.h> +#include <dirent.h> #ifdef __NR__llseek _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, loff_t *, res, unsigned int, wh); @@ -120,8 +121,24 @@ void SysAddFloppyPrefs(void) { #if defined(__linux__) - PrefsAddString("floppy", "/dev/fd0u1440"); - PrefsAddString("floppy", "/dev/fd1u1440"); + if (access("/dev/.devfsd", F_OK)) { + PrefsAddString("floppy", "/dev/fd0u1440"); + PrefsAddString("floppy", "/dev/fd1u1440"); + } else { + DIR* fd_dir = opendir("/dev/floppy"); + if (fd_dir) { + struct dirent* floppy_dev; + while ((floppy_dev = readdir(fd_dir)) != NULL) { + if (strstr(floppy_dev->d_name, "u1440") != NULL) { + char *fd_dev = new char[20]; + sprintf(fd_dev, "/dev/floppy/%s", floppy_dev->d_name); + printf("Added '%s' to list of floppy drives.\n", fd_dev); + PrefsAddString("floppy", fd_dev); + } + } + closedir(fd_dir); + } + } #elif defined(__NetBSD__) PrefsAddString("floppy", "/dev/fd0a"); PrefsAddString("floppy", "/dev/fd1a"); @@ -176,7 +193,23 @@ return; #if defined(__linux__) - PrefsAddString("cdrom", "/dev/cdrom"); + if (access("/dev/.devfsd", F_OK)) + PrefsAddString("cdrom", "/dev/cdrom"); + else { + DIR* cd_dir = opendir("/dev/cdroms"); + if (cd_dir) { + struct dirent* cdrom_dev; + while ((cdrom_dev = readdir(cd_dir)) != NULL) { + if (strcmp(cdrom_dev->d_name, ".") != 0 && strcmp(cdrom_dev->d_name, "..") != 0) { + char *cd_dev = new char[20]; + strcpy(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name); + printf("Added '%s' to list of cdrom drives.\n", cd_dev); + PrefsAddString("cdrom", cd_dev); + } + } + closedir(cd_dir); + } + } #elif defined(__FreeBSD__) PrefsAddString("cdrom", "/dev/cd0c"); #elif defined(__NetBSD__) @@ -192,8 +225,13 @@ void SysAddSerialPrefs(void) { #if defined(__linux__) - PrefsAddString("seriala", "/dev/ttyS0"); - PrefsAddString("serialb", "/dev/ttyS1"); + if (access("/dev/.devfsd", F_OK)) { + PrefsAddString("seriala", "/dev/ttyS0"); + PrefsAddString("serialb", "/dev/ttyS1"); + } else { + PrefsAddString("seriala", "/dev/tts/0"); + PrefsAddString("serialb", "/dev/tts/1"); + } #elif defined(__FreeBSD__) PrefsAddString("seriala", "/dev/cuaa0"); PrefsAddString("serialb", "/dev/cuaa1"); <~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~> Stan Kochen <The_Assassin> <--------------------------------> Beyondunreal.com Forums <BuF> http://www.beyondunreal.com <--------------------------------> ReSpawners United - Unreal Tournament clan <RSU> http://www.clanrsu.com/ <~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~> ________________________________________________ Don't E-Mail, ZipMail! http://www.zipmail.com/ |
From: Christian B. <cb...@th...> - 2002-03-27 20:12:00
|
Hi! On Wed, Mar 27, 2002 at 02:19:28PM -0500, [RSU]The_Assassin|BuF wrote: > Small patch for /dev filesystem support. Thanks! > Tried to stick to your coding style as much as possible. ;) That's appreciated. :-) Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/ |
From: <gb...@di...> - 2002-03-29 16:59:43
|
Hi, > Small patch for /dev filesystem support. Provided some minor fixes (s/strcpy/sprintf/ for cd_dev[]), it works well for CDs with MDK 8.1 though for some reason I had two entries in /dev/cdroms/ henceforth two mountpoints in MacOS side. ;-) Bye, Gwenole. |
From: [RSU]The_Assassin|BuF <the...@zi...> - 2002-03-29 18:58:20
|
Yep, I just noticed the bug. Maybe I should turn off music while coding. ;) A list of devices like the windows version would be nice. I'm reading up on some gtk/gdk/X tuts now, so maybe I can do some programming on that later. Though I doubt I'll be able to help you with the emulation itself. :/ <~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~> Stan Kochen <The_Assassin> <--------------------------------> Beyondunreal.com Forums <BuF> http://www.beyondunreal.com <--------------------------------> ReSpawners United - Unreal Tournament clan <RSU> http://www.clanrsu.com/ <~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~> ________________________________________________ Don't E-Mail, ZipMail! http://www.zipmail.com/ |