From owner-freebsd-ports@FreeBSD.ORG Thu Aug 17 05:15:03 2006 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C0A916A580 for ; Thu, 17 Aug 2006 05:15:03 +0000 (UTC) (envelope-from robertjenssen@ozemail.com.au) Received: from mail-ihug.icp-qv1-irony1.iinet.net.au (ihug-mail.icp-qv1-irony1.iinet.net.au [203.59.1.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id B178E43D45 for ; Thu, 17 Aug 2006 05:15:01 +0000 (GMT) (envelope-from robertjenssen@ozemail.com.au) Received: from 124-168-8-171.dyn.iinet.net.au (HELO [10.131.211.172]) ([124.168.8.171]) by mail-ihug.icp-qv1-irony1.iinet.net.au with ESMTP; 17 Aug 2006 13:14:59 +0800 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="4.08,134,1154880000"; d="scan'208"; a="605029768:sNHT1689904982" From: Robert Jenssen To: nox@jelal.kn-bremen.de Date: Thu, 17 Aug 2006 15:14:56 +1000 User-Agent: KMail/1.9.3 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Rt/4EiDTmwb5FWZ" Message-Id: <200608171514.57223.robertjenssen@ozemail.com.au> Cc: ports@freebsd.org Subject: FreeBSD Port: qemu-0.8.2 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 05:15:03 -0000 --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 #endif #ifdef __FreeBSD__ #include + #include + #include #endif #else #ifndef __sun__ #include #include *************** *** 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--