From 8f1962d8fc528050e30fea347d88c0f96b905608 Mon Sep 17 00:00:00 2001 From: cperciva Date: Wed, 24 Jun 2009 23:17:00 +0000 Subject: Make sysinstall search for /dev/daXa and register such devices as USB disks. This covers the common case of unsliced USB drives, and makes it possible to select them as installation source media. PR: 61152, 115197, 135016 Submitted by: randi MFC after: 1 month --- usr.sbin/sysinstall/devices.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'usr.sbin/sysinstall/devices.c') diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index e78c268..3ba8732 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -65,6 +65,8 @@ static int numDevs; DEVICE_ENTRY(DEVICE_TYPE_NETWORK, name, descr, 0) #define SERIAL(name, descr, max) \ DEVICE_ENTRY(DEVICE_TYPE_NETWORK, name, descr, max) +#define USB(name, descr, max) \ + DEVICE_ENTRY(DEVICE_TYPE_USB, name, descr, max) static struct _devname { DeviceType type; @@ -89,6 +91,7 @@ static struct _devname { DISK("mfid%d", "LSI MegaRAID SAS array", 4), FLOPPY("fd%d", "floppy drive unit A", 4), SERIAL("cuad%d", "%s on device %s (COM%d)", 16), + USB("da%da", "USB Mass Storage Device", 16), NETWORK("ae", "Attansic/Atheros L2 Fast Ethernet"), NETWORK("age", "Attansic/Atheros L1 Gigabit Ethernet"), NETWORK("alc", "Atheros AR8131/AR8132 PCIe Ethernet"), @@ -392,6 +395,22 @@ skipif: } break; + case DEVICE_TYPE_USB: + fd = deviceTry(device_names[i], try, j); + if (fd >= 0) { + char n[BUFSIZ]; + + close(fd); + snprintf(n, sizeof(n), device_names[i].name, j); + deviceRegister(strdup(n), device_names[i].description, + strdup(try), DEVICE_TYPE_USB, TRUE, mediaInitUSB, + mediaGetUSB, mediaShutdownUSB, NULL); + + if (isDebug()) + msgDebug("Found a USB disk for %s\n", try); + } + break; + case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i], try, j); /* The only network devices that you can open this way are serial ones */ -- cgit v1.1