Date: Thu, 17 Aug 2006 15:14:56 +1000 From: Robert Jenssen <robertjenssen@ozemail.com.au> To: nox@jelal.kn-bremen.de Cc: ports@freebsd.org Subject: FreeBSD Port: qemu-0.8.2 Message-ID: <200608171514.57223.robertjenssen@ozemail.com.au>
next in thread | raw e-mail | index | archive | help
--Boundary-00=_Rt/4EiDTmwb5FWZ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I am using qemu to emulate win2k on FreeBSB-6.1. I particularly wanted to run some proprietary software requiring a dongle on the parallel port and made the patch attached. It seems to work for me so I thought it might be useful to others. (I haven't attempted to print anything but win2k installed an attached printer.) Cheers, Rob Jenssen --Boundary-00=_Rt/4EiDTmwb5FWZ Content-Type: text/x-diff; charset="us-ascii"; name="vl.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vl.c.patch" *** vl.c.orig Thu Aug 17 11:47:16 2006 --- vl.c Thu Aug 17 12:53:30 2006 *************** *** 46,55 **** --- 46,57 ---- #ifndef __APPLE__ #include <libutil.h> #endif #ifdef __FreeBSD__ #include <sys/module.h> + #include <dev/ppbus/ppi.h> + #include <dev/ppbus/ppbconf.h> #endif #else #ifndef __sun__ #include <linux/if.h> #include <linux/if_tun.h> *************** *** 1726,1736 **** chr->chr_write = null_chr_write; chr->chr_add_read_handler = null_chr_add_read_handler; chr->chr_ioctl = pp_ioctl; return chr; } ! #endif /* defined(__linux__) */ #else CharDriverState *qemu_chr_open_pty(void) { return NULL; --- 1728,1797 ---- chr->chr_write = null_chr_write; chr->chr_add_read_handler = null_chr_add_read_handler; chr->chr_ioctl = pp_ioctl; return chr; } ! ! #elif defined(__FreeBSD__) ! static int pp_ioctl(CharDriverState *chr, int cmd, void *arg) ! { ! int fd = (int)chr->opaque; ! uint8_t b; ! ! switch(cmd) { ! case CHR_IOCTL_PP_READ_DATA: ! if (ioctl(fd, PPIGDATA, &b) < 0) ! return -ENOTSUP; ! *(uint8_t *)arg = b; ! break; ! case CHR_IOCTL_PP_WRITE_DATA: ! b = *(uint8_t *)arg; ! if (ioctl(fd, PPISDATA, &b) < 0) ! return -ENOTSUP; ! break; ! case CHR_IOCTL_PP_READ_CONTROL: ! if (ioctl(fd, PPIGCTRL, &b) < 0) ! return -ENOTSUP; ! *(uint8_t *)arg = b; ! break; ! case CHR_IOCTL_PP_WRITE_CONTROL: ! b = *(uint8_t *)arg; ! if (ioctl(fd, PPISCTRL, &b) < 0) ! return -ENOTSUP; ! break; ! case CHR_IOCTL_PP_READ_STATUS: ! if (ioctl(fd, PPIGSTATUS, &b) < 0) ! return -ENOTSUP; ! *(uint8_t *)arg = b; ! break; ! default: ! return -ENOTSUP; ! } ! return 0; ! } ! ! CharDriverState *qemu_chr_open_pp(const char *filename) ! { ! CharDriverState *chr; ! int fd; ! ! fd = open(filename, O_RDWR); ! if (fd < 0) ! return NULL; ! ! chr = qemu_mallocz(sizeof(CharDriverState)); ! if (!chr) { ! close(fd); ! return NULL; ! } ! chr->opaque = (void *)fd; ! chr->chr_write = null_chr_write; ! chr->chr_add_read_handler = null_chr_add_read_handler; ! chr->chr_ioctl = pp_ioctl; ! return chr; ! } ! #endif #else CharDriverState *qemu_chr_open_pty(void) { return NULL; *************** *** 2565,2574 **** --- 2626,2643 ---- return qemu_chr_open_pp(filename); } else if (strstart(filename, "/dev/", NULL)) { return qemu_chr_open_tty(filename); } else + #elif defined(__FreeBSD__) + if (strstart(filename, "/dev/ppi", NULL)) { + return qemu_chr_open_pp(filename); + } else + if (strstart(filename, "/dev/", NULL)) { + return qemu_chr_open_tty(filename); + } else + #endif #ifdef _WIN32 if (strstart(filename, "COM", NULL)) { return qemu_chr_open_win(filename); } else *************** *** 5867,5876 **** --- 5936,5946 ---- } break; case QEMU_OPTION_nographic: pstrcpy(monitor_device, sizeof(monitor_device), "stdio"); pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio"); + pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null"); nographic = 1; break; case QEMU_OPTION_kernel: kernel_filename = optarg; break; --Boundary-00=_Rt/4EiDTmwb5FWZ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608171514.57223.robertjenssen>