summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-05-12 03:01:17 +0000
committerjhb <jhb@FreeBSD.org>2000-05-12 03:01:17 +0000
commit1ec3688bd005be0ac734c873c8de9e941e8ee02c (patch)
treed77f0c1a643acb787894f1743d1bbcf6fb5abc70 /usr.sbin
parentc97d9a50e81a6408372441d5846eacb938a646db (diff)
downloadFreeBSD-src-1ec3688bd005be0ac734c873c8de9e941e8ee02c.zip
FreeBSD-src-1ec3688bd005be0ac734c873c8de9e941e8ee02c.tar.gz
Add support for USB to sysinstall. This includes running usbd and
setting 'usbd_enable' in rc.conf during nwe installs if USB is detected. Also, since usbd already handles USB mice automatically, note that the mouse setup section in sysinstall only applies to non-USB mice.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/Makefile4
-rw-r--r--usr.sbin/sade/install.c2
-rw-r--r--usr.sbin/sade/main.c3
-rw-r--r--usr.sbin/sade/sade.h3
-rw-r--r--usr.sbin/sade/usb.c44
-rw-r--r--usr.sbin/sysinstall/Makefile4
-rw-r--r--usr.sbin/sysinstall/install.c2
-rw-r--r--usr.sbin/sysinstall/main.c3
-rw-r--r--usr.sbin/sysinstall/sysinstall.h3
-rw-r--r--usr.sbin/sysinstall/usb.c44
10 files changed, 106 insertions, 6 deletions
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 3e9dc68..9074ad2 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -14,8 +14,8 @@ SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
msg.c network.c nfs.c options.c package.c pccard.c \
- system.c tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
- keymap.h
+ system.c tape.c tcpip.c termcap.c ufs.c usb.c user.c variable.c \
+ wizard.c keymap.h
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I${.OBJDIR}
.if ${MACHINE_ARCH} != "i386" || defined(X_AS_PKG)
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index da56363..db5719e 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -608,7 +608,7 @@ nodisks:
#endif /* notyet */
dialog_clear_norefresh();
- if (!msgYesNo("Does this system have a mouse attached to it?"))
+ if (!msgYesNo("Does this system have a non-USB mouse attached to it?"))
dmenuOpenSimple(&MenuMouse, FALSE);
/* Now would be a good time to checkpoint the configuration data */
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index 885b6cb..1fde541 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/main.c
@@ -90,6 +90,9 @@ main(int argc, char **argv)
/* Initialize PC-card */
pccardInitialize();
+ /* Initialize USB */
+ usbInitialize();
+
/* Probe for all relevant devices on the system */
deviceGetAll();
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 815ca4a..b3e6494 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -733,6 +733,9 @@ extern void mediaShutdownUFS(Device *dev);
extern Boolean mediaInitUFS(Device *dev);
extern FILE *mediaGetUFS(Device *dev, char *file, Boolean probe);
+/* usb.c */
+extern void usbInitialize(void);
+
/* user.c */
extern int userAddGroup(dialogMenuItem *self);
extern int userAddUser(dialogMenuItem *self);
diff --git a/usr.sbin/sade/usb.c b/usr.sbin/sade/usb.c
new file mode 100644
index 0000000..4eedbd5
--- /dev/null
+++ b/usr.sbin/sade/usb.c
@@ -0,0 +1,44 @@
+/*
+ * USB support for sysinstall
+ *
+ * $FreeBSD$
+ *
+ * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org>. All rights reserved.
+ *
+ * This software may be used, modified, copied, and distributed, in
+ * both source and binary form provided that the above copyright and
+ * these terms are retained. Under no circumstances is the author
+ * responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its
+ * use.
+ */
+
+#include "sysinstall.h"
+#include <sys/fcntl.h>
+#include <sys/time.h>
+
+void
+usbInitialize(void)
+{
+ int fd;
+ WINDOW *w;
+
+ if (!RunningAsInit && !Fake) {
+ /* It's not my job... */
+ return;
+ }
+
+ if ((fd = open("/dev/usb", O_RDONLY)) < 0) {
+ msgDebug("Can't open USB controller.\n");
+ return;
+ }
+ close(fd);
+
+ w = savescr();
+ msgNotify("Initializing USB controller....");
+
+ variable_set2("usbd_enable", "YES", 1);
+
+ vsystem("/stand/usbd");
+ restorescr(w);
+}
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index 3e9dc68..9074ad2 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -14,8 +14,8 @@ SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
msg.c network.c nfs.c options.c package.c pccard.c \
- system.c tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
- keymap.h
+ system.c tape.c tcpip.c termcap.c ufs.c usb.c user.c variable.c \
+ wizard.c keymap.h
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I${.OBJDIR}
.if ${MACHINE_ARCH} != "i386" || defined(X_AS_PKG)
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index da56363..db5719e 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -608,7 +608,7 @@ nodisks:
#endif /* notyet */
dialog_clear_norefresh();
- if (!msgYesNo("Does this system have a mouse attached to it?"))
+ if (!msgYesNo("Does this system have a non-USB mouse attached to it?"))
dmenuOpenSimple(&MenuMouse, FALSE);
/* Now would be a good time to checkpoint the configuration data */
diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c
index 885b6cb..1fde541 100644
--- a/usr.sbin/sysinstall/main.c
+++ b/usr.sbin/sysinstall/main.c
@@ -90,6 +90,9 @@ main(int argc, char **argv)
/* Initialize PC-card */
pccardInitialize();
+ /* Initialize USB */
+ usbInitialize();
+
/* Probe for all relevant devices on the system */
deviceGetAll();
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 815ca4a..b3e6494 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -733,6 +733,9 @@ extern void mediaShutdownUFS(Device *dev);
extern Boolean mediaInitUFS(Device *dev);
extern FILE *mediaGetUFS(Device *dev, char *file, Boolean probe);
+/* usb.c */
+extern void usbInitialize(void);
+
/* user.c */
extern int userAddGroup(dialogMenuItem *self);
extern int userAddUser(dialogMenuItem *self);
diff --git a/usr.sbin/sysinstall/usb.c b/usr.sbin/sysinstall/usb.c
new file mode 100644
index 0000000..4eedbd5
--- /dev/null
+++ b/usr.sbin/sysinstall/usb.c
@@ -0,0 +1,44 @@
+/*
+ * USB support for sysinstall
+ *
+ * $FreeBSD$
+ *
+ * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org>. All rights reserved.
+ *
+ * This software may be used, modified, copied, and distributed, in
+ * both source and binary form provided that the above copyright and
+ * these terms are retained. Under no circumstances is the author
+ * responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its
+ * use.
+ */
+
+#include "sysinstall.h"
+#include <sys/fcntl.h>
+#include <sys/time.h>
+
+void
+usbInitialize(void)
+{
+ int fd;
+ WINDOW *w;
+
+ if (!RunningAsInit && !Fake) {
+ /* It's not my job... */
+ return;
+ }
+
+ if ((fd = open("/dev/usb", O_RDONLY)) < 0) {
+ msgDebug("Can't open USB controller.\n");
+ return;
+ }
+ close(fd);
+
+ w = savescr();
+ msgNotify("Initializing USB controller....");
+
+ variable_set2("usbd_enable", "YES", 1);
+
+ vsystem("/stand/usbd");
+ restorescr(w);
+}
OpenPOWER on IntegriCloud