Here's a diff with my edits. With these changes, the printer keeps being reported as busy, although I seem to be able to write to the /dev/lpt0 device, and it is seen. As Ed Schouten pointed out on IRC probably this unit2minor stuff needs to go back in. Back to work for this machine... --- lpt.c.jhb 2009-01-23 14:31:43.000000000 +0000 +++ lpt.c 2009-01-23 15:21:08.000000000 +0000 _at__at_ -140,6 +140,7 _at__at_ static timeout_t lptout; static int lpt_port_test(device_t dev, u_char data, u_char mask); +static int lpt_detach(device_t dev); static int lpt_detect(device_t dev); #define DEVTOSOFTC(dev) \ _at__at_ -408,12 +409,22 _at__at_ sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); sc->sc_statbuf = malloc(BUFSTATSIZE, M_DEVBUF, M_WAITOK); sc->sc_dev = dev; - sc->sc_cdev = make_dev(&lpt_cdevsw, unit, + sc->sc_cdev = make_dev(&lpt_cdevsw, unit * 2, UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d", unit); + if (sc->sc_cdev == NULL) { + device_printf(dev, "Unable to create data device node\n"); + (void)lpt_detach(dev); + return (ENXIO); + } sc->sc_cdev->si_drv1 = sc; sc->sc_cdev->si_drv2 = 0; - sc->sc_cdev_bypass = make_dev(&lpt_cdevsw, unit, + sc->sc_cdev_bypass = make_dev(&lpt_cdevsw, (unit * 2) + 1, UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", unit); + if (sc->sc_cdev_bypass == NULL) { + device_printf(dev, "Unable to create control device node\n"); + (void)lpt_detach(dev); + return (ENXIO); + } sc->sc_cdev_bypass->si_drv1 = sc; sc->sc_cdev_bypass->si_drv2 = (void *)LP_BYPASS; return (0); _at__at_ -425,8 +436,10 _at__at_ struct lpt_data *sc = DEVTOSOFTC(dev); device_t ppbus = device_get_parent(dev); - destroy_dev(sc->sc_cdev); - destroy_dev(sc->sc_cdev_bypass); + if (sc->sc_cdev) + destroy_dev(sc->sc_cdev); + if (sc->sc_cdev_bypass) + destroy_dev(sc->sc_cdev_bypass); ppb_lock(ppbus); lpt_release_ppbus(dev); ppb_unlock(ppbus);Received on Fri Jan 23 2009 - 14:50:26 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:40 UTC