ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/sys_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/sys_unix.cpp (file contents):
Revision 1.15 by cebix, 2002-03-20T19:03:41Z vs.
Revision 1.16 by cebix, 2002-03-27T20:11:12Z

# Line 31 | Line 31
31   #include <linux/major.h>
32   #include <linux/kdev_t.h>
33   #include <linux/unistd.h>
34 + #include <dirent.h>
35  
36   #ifdef __NR__llseek
37   _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, loff_t *, res, unsigned int, wh);
# Line 120 | Line 121 | void SysMountFirstFloppy(void)
121   void SysAddFloppyPrefs(void)
122   {
123   #if defined(__linux__)
124 <        PrefsAddString("floppy", "/dev/fd0u1440");
125 <        PrefsAddString("floppy", "/dev/fd1u1440");
124 >        if (access("/dev/.devfsd", F_OK)) {
125 >                PrefsAddString("floppy", "/dev/fd0u1440");
126 >                PrefsAddString("floppy", "/dev/fd1u1440");
127 >        } else {
128 >                DIR *fd_dir = opendir("/dev/floppy");
129 >                if (fd_dir) {
130 >                        struct dirent *floppy_dev;
131 >                        while ((floppy_dev = readdir(fd_dir)) != NULL) {
132 >                                if (strstr(floppy_dev->d_name, "u1440") != NULL) {
133 >                                        char *fd_dev = new char[20];
134 >                                        sprintf(fd_dev, "/dev/floppy/%s", floppy_dev->d_name);
135 >                                        PrefsAddString("floppy", fd_dev);
136 >                                        delete[] fd_dev;
137 >                                }
138 >                        }
139 >                        closedir(fd_dir);
140 >                }
141 >        }
142   #elif defined(__NetBSD__)
143          PrefsAddString("floppy", "/dev/fd0a");
144          PrefsAddString("floppy", "/dev/fd1a");
# Line 176 | Line 193 | void SysAddCDROMPrefs(void)
193                  return;
194  
195   #if defined(__linux__)
196 <        PrefsAddString("cdrom", "/dev/cdrom");
196 >        if (access("/dev/.devfsd", F_OK))
197 >                PrefsAddString("cdrom", "/dev/cdrom");
198 >        else {
199 >                DIR *cd_dir = opendir("/dev/cdroms");
200 >                if (cd_dir) {
201 >                        struct dirent *cdrom_dev;
202 >                        while ((cdrom_dev = readdir(cd_dir)) != NULL) {
203 >                                if (strcmp(cdrom_dev->d_name, ".") != 0 && strcmp(cdrom_dev->d_name, "..") != 0) {
204 >                                        char *cd_dev = new char[20];
205 >                                        strcpy(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name);
206 >                                        PrefsAddString("cdrom", cd_dev);
207 >                                        delete[] cd_dev;
208 >                                }
209 >                        }
210 >                        closedir(cd_dir);
211 >                }
212 >        }
213   #elif defined(__FreeBSD__)
214          PrefsAddString("cdrom", "/dev/cd0c");
215   #elif defined(__NetBSD__)
# Line 192 | Line 225 | void SysAddCDROMPrefs(void)
225   void SysAddSerialPrefs(void)
226   {
227   #if defined(__linux__)
228 <        PrefsAddString("seriala", "/dev/ttyS0");
229 <        PrefsAddString("serialb", "/dev/ttyS1");
228 >        if (access("/dev/.devfsd", F_OK)) {
229 >                PrefsAddString("seriala", "/dev/ttyS0");
230 >                PrefsAddString("serialb", "/dev/ttyS1");
231 >        } else {
232 >                PrefsAddString("seriala", "/dev/tts/0");
233 >                PrefsAddString("serialb", "/dev/tts/1");
234 >        }
235   #elif defined(__FreeBSD__)
236          PrefsAddString("seriala", "/dev/cuaa0");
237          PrefsAddString("serialb", "/dev/cuaa1");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines