Initial import from FreeBSD RELENG_4:
[dragonfly.git] / release / sysinstall / usb.c
1 /*
2  * USB support for sysinstall
3  *
4  * $FreeBSD: src/release/sysinstall/usb.c,v 1.1.2.1 2000/06/08 23:08:24 jhb Exp $
5  *
6  * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org>.  All rights reserved.
7  *
8  * This software may be used, modified, copied, and distributed, in
9  * both source and binary form provided that the above copyright and
10  * these terms are retained. Under no circumstances is the author
11  * responsible for the proper functioning of this software, nor does
12  * the author assume any responsibility for damages incurred with its
13  * use.
14  */
15
16 #include "sysinstall.h"
17 #include <sys/fcntl.h>
18 #include <sys/time.h>
19
20 void
21 usbInitialize(void)
22 {
23     int fd;
24     WINDOW *w;
25     
26     if (!RunningAsInit && !Fake) {
27         /* It's not my job... */
28         return;
29     }
30
31     if ((fd = open("/dev/usb", O_RDONLY)) < 0) {
32         msgDebug("Can't open USB controller.\n");
33         return;
34     }
35     close(fd);
36
37     w = savescr();
38     msgNotify("Initializing USB controller....");
39     
40     variable_set2("usbd_enable", "YES", 1);
41
42     vsystem("/stand/usbd");
43     restorescr(w);
44 }