From owner-svn-src-projects@FreeBSD.ORG Sun Jul 31 13:35:26 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36366106564A; Sun, 31 Jul 2011 13:35:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C8BE8FC15; Sun, 31 Jul 2011 13:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6VDZPp7048272; Sun, 31 Jul 2011 13:35:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6VDZP2p048270; Sun, 31 Jul 2011 13:35:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107311335.p6VDZP2p048270@svn.freebsd.org> From: Alexander Motin Date: Sun, 31 Jul 2011 13:35:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224545 - projects/hid/lib/libusbhid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2011 13:35:26 -0000 Author: mav Date: Sun Jul 31 13:35:25 2011 New Revision: 224545 URL: http://svn.freebsd.org/changeset/base/224545 Log: Teach descriptor parser to work with several item types simultaneously. Modified: projects/hid/lib/libusbhid/parse.c Modified: projects/hid/lib/libusbhid/parse.c ============================================================================== --- projects/hid/lib/libusbhid/parse.c Sun Jul 31 08:53:59 2011 (r224544) +++ projects/hid/lib/libusbhid/parse.c Sun Jul 31 13:35:25 2011 (r224545) @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #define MAXUSAGE 100 #define MAXPUSH 4 #define MAXID 64 +#define ITEMTYPES 3 struct hid_pos_data { int32_t rid; - uint32_t pos; + uint32_t pos[ITEMTYPES]; }; struct hid_data { @@ -55,6 +56,7 @@ struct hid_data { const uint8_t *p; struct hid_item cur[MAXPUSH]; struct hid_pos_data last_pos[MAXID]; + uint32_t pos[ITEMTYPES]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; int32_t usage_last; /* last seen usage */ @@ -92,7 +94,7 @@ hid_clear_local(hid_item_t *c) static void hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) { - uint8_t i; + uint8_t i, j; /* check for same report ID - optimise */ @@ -113,7 +115,8 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = c->report_ID; - s->last_pos[i].pos = c->pos; + for (j = 0; j < ITEMTYPES; j++) + s->last_pos[i].pos[j] = s->pos[j]; } /* store next report ID */ @@ -134,9 +137,12 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = next_rID; - c->pos = s->last_pos[i].pos; - } else - c->pos = 0; /* Out of RID entries. */ + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = s->last_pos[i].pos[j]; + } else { + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = 0; /* Out of RID entries. */ + } } /*------------------------------------------------------------------------* @@ -206,7 +212,6 @@ hid_get_item(hid_data_t s, hid_item_t *h { hid_item_t *c; unsigned int bTag, bType, bSize; - uint32_t oldpos; int32_t mask; int32_t dval; @@ -240,7 +245,8 @@ hid_get_item(hid_data_t s, hid_item_t *h */ if (s->kindset & (1 << c->kind)) { *h = *c; - c->pos += c->report_size * c->report_count; + h->pos = s->pos[c->kind]; + s->pos[c->kind] += c->report_size * c->report_count; return (1); } } @@ -406,14 +412,10 @@ hid_get_item(hid_data_t s, hid_item_t *h case 11: /* Pop */ s->pushlevel --; if (s->pushlevel < MAXPUSH) { - /* preserve position */ - oldpos = c->pos; c = &s->cur[s->pushlevel]; /* restore size and count */ s->loc_size = c->report_size; s->loc_count = c->report_count; - /* set default item location */ - c->pos = oldpos; c->report_size = 0; c->report_count = 0; } From owner-svn-src-projects@FreeBSD.ORG Sun Jul 31 14:38:26 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D2291065670; Sun, 31 Jul 2011 14:38:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0568FC12; Sun, 31 Jul 2011 14:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6VEcQPq050287; Sun, 31 Jul 2011 14:38:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6VEcQ1C050285; Sun, 31 Jul 2011 14:38:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107311438.p6VEcQ1C050285@svn.freebsd.org> From: Alexander Motin Date: Sun, 31 Jul 2011 14:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224547 - projects/hid/sys/dev/usb X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2011 14:38:26 -0000 Author: mav Date: Sun Jul 31 14:38:25 2011 New Revision: 224547 URL: http://svn.freebsd.org/changeset/base/224547 Log: Do not block zero report id. It is correct value for devices with single ID. Modified: projects/hid/sys/dev/usb/usb_request.c Modified: projects/hid/sys/dev/usb/usb_request.c ============================================================================== --- projects/hid/sys/dev/usb/usb_request.c Sun Jul 31 13:49:15 2011 (r224546) +++ projects/hid/sys/dev/usb/usb_request.c Sun Jul 31 14:38:25 2011 (r224547) @@ -1769,7 +1769,7 @@ usbd_req_get_report(struct usb_device *u struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL) || (id == 0)) { + if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); } DPRINTFN(5, "len=%d\n", len); From owner-svn-src-projects@FreeBSD.ORG Sun Jul 31 16:08:29 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97D39106566B; Sun, 31 Jul 2011 16:08:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87B228FC12; Sun, 31 Jul 2011 16:08:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6VG8TvI053484; Sun, 31 Jul 2011 16:08:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6VG8Tvk053482; Sun, 31 Jul 2011 16:08:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107311608.p6VG8Tvk053482@svn.freebsd.org> From: Alexander Motin Date: Sun, 31 Jul 2011 16:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224549 - projects/hid/sys/dev/usb/input X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2011 16:08:29 -0000 Author: mav Date: Sun Jul 31 16:08:29 2011 New Revision: 224549 URL: http://svn.freebsd.org/changeset/base/224549 Log: Tune USB_GET_REPORT/USB_SET_REPORT IOCTLs to work with multiple report, possibly with different sizes. Modified: projects/hid/sys/dev/usb/input/uhid.c Modified: projects/hid/sys/dev/usb/input/uhid.c ============================================================================== --- projects/hid/sys/dev/usb/input/uhid.c Sun Jul 31 15:23:21 2011 (r224548) +++ projects/hid/sys/dev/usb/input/uhid.c Sun Jul 31 16:08:29 2011 (r224549) @@ -566,8 +566,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_get_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_SET_REPORT: @@ -592,8 +594,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_set_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_GET_REPORT_ID: From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 02:56:02 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9041106566C; Mon, 1 Aug 2011 02:56:02 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF25D8FC15; Mon, 1 Aug 2011 02:56:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p712u2ML073868; Mon, 1 Aug 2011 02:56:02 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p712u2vS073866; Mon, 1 Aug 2011 02:56:02 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201108010256.p712u2vS073866@svn.freebsd.org> From: Mark Linimon Date: Mon, 1 Aug 2011 02:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224557 - projects/portbuild/qmanager X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 02:56:03 -0000 Author: linimon (doc,ports committer) Date: Mon Aug 1 02:56:02 2011 New Revision: 224557 URL: http://svn.freebsd.org/changeset/base/224557 Log: Touch up some of the debug stuff. Modified: projects/portbuild/qmanager/qmanagerhandler.py Modified: projects/portbuild/qmanager/qmanagerhandler.py ============================================================================== --- projects/portbuild/qmanager/qmanagerhandler.py Sun Jul 31 23:09:11 2011 (r224556) +++ projects/portbuild/qmanager/qmanagerhandler.py Mon Aug 1 02:56:02 2011 (r224557) @@ -4,7 +4,7 @@ import SocketServer, threading, freebsd, from qmanagerclient import * from acl import * -DEBUG=False +DEBUG_HANDLER = False class ServerReplyException(Exception): pass @@ -140,13 +140,13 @@ class UNIXhandler(SocketServer.StreamReq conn = QManagerServerConn(self.rfile, self.wfile, self.event) try: - if DEBUG: + if DEBUG_HANDLER: print "at UNIXhandler.handle()" (conn.cmd, conn.args) = conn.receive() - if DEBUG: + if DEBUG_HANDLER: print "past conn.receive() for " + conn.cmd + " and " + str( conn.args ) (conn.uid, conn.gids) = freebsd.getpeerid(self.request) - if DEBUG: + if DEBUG_HANDLER: print "past freebsd.getpeerid" if conn.uid == 0: # Allow root to override uid/gids, when proxying for a user @@ -159,14 +159,14 @@ class UNIXhandler(SocketServer.StreamReq except KeyError, TypeError: pass except Exception, e: - if DEBUG: + if DEBUG_HANDLER: print "UNIXhandler.handle(): exception: " + str( e ) conn.send(401) # XXX other errors too return self.server.wqueue.put(conn) - if DEBUG: + if DEBUG_HANDLER: print "past wqueue.put() for " + conn.cmd + " and " + str( conn.args ) self.event.wait() # Don't close socket until the command finishes - if DEBUG: + if DEBUG_HANDLER: print "past event.wait() for " + conn.cmd + " and " + str( conn.args ) From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 02:57:02 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28FC81065670; Mon, 1 Aug 2011 02:57:02 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DFB58FC0A; Mon, 1 Aug 2011 02:57:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p712v1jG073933; Mon, 1 Aug 2011 02:57:01 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p712v1At073931; Mon, 1 Aug 2011 02:57:01 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201108010257.p712v1At073931@svn.freebsd.org> From: Mark Linimon Date: Mon, 1 Aug 2011 02:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224558 - projects/portbuild/qmanager X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 02:57:02 -0000 Author: linimon (doc,ports committer) Date: Mon Aug 1 02:57:01 2011 New Revision: 224558 URL: http://svn.freebsd.org/changeset/base/224558 Log: Make the error handling tell us more about the exceptions, if any. Modified: projects/portbuild/qmanager/qmanagerclient.py Modified: projects/portbuild/qmanager/qmanagerclient.py ============================================================================== --- projects/portbuild/qmanager/qmanagerclient.py Mon Aug 1 02:56:02 2011 (r224557) +++ projects/portbuild/qmanager/qmanagerclient.py Mon Aug 1 02:57:01 2011 (r224558) @@ -300,12 +300,12 @@ class QManagerClientConn(QManagerConnect return s except Exception, e: if self.stderr: - self.stderr.write("QManagerClientConn: exception in s.makefile(): " + str( e ) + "\n") + self.stderr.write("\nQManagerClientConn: exception in s.makefile(): " + str( e ) + "\n") self.stderr.write(str( path ) + "\n") self.stderr.flush() except Exception, e: if self.stderr: - self.stderr.write("QManagerClientConn: exception in s.connect(): " + str( e ) + "\n") + self.stderr.write("\nQManagerClientConn: exception in s.connect(): " + str( e ) + "\n") self.stderr.write(str( path ) + "\n") self.stderr.flush() try: @@ -314,7 +314,7 @@ class QManagerClientConn(QManagerConnect pass else: if self.stderr: - self.stderr.write("QManagerClientConn: qmanager socket file does not exist!\n") + self.stderr.write("\nQManagerClientConn: qmanager socket file does not exist!\n") self.stderr.flush() return None @@ -333,8 +333,9 @@ class QManagerClientConn(QManagerConnect while True: try: return self.CS.send(self.sockfile, cmd, vars) - except: + except Exception, e: if self.stderr: + self.stderr.write("\nQManagerClientConn: exception in self.SC.send(): " + str( e ) + "\n") self.stderr.write("Error sending command...\n") self.stderr.flush() sleep(timeout) @@ -349,8 +350,9 @@ class QManagerClientConn(QManagerConnect while True: try: return self.SC.receive(self.sockfile) - except: + except Exception, e: if self.stderr: + self.stderr.write("\nQManagerClientConn: exception in self.SC.receive(): " + str( e ) + "\n") self.stderr.write("Error receiving command...\n") self.stderr.flush() sleep(timeout) @@ -394,7 +396,7 @@ class QManagerClientConn(QManagerConnect if self.connect(): break else: - self.stderr.write("Error connecting to qmanager...\n") + self.stderr.write("\nQManagerClientConn: error connecting to qmanager in command()...\n") self.stderr.flush() sleep(timeout) if timeout < 64: From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 02:57:47 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 178741065675; Mon, 1 Aug 2011 02:57:47 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 076C78FC15; Mon, 1 Aug 2011 02:57:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p712vkgm073991; Mon, 1 Aug 2011 02:57:46 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p712vkf5073989; Mon, 1 Aug 2011 02:57:46 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201108010257.p712vkf5073989@svn.freebsd.org> From: Mark Linimon Date: Mon, 1 Aug 2011 02:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224559 - projects/portbuild/qmanager X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 02:57:47 -0000 Author: linimon (doc,ports committer) Date: Mon Aug 1 02:57:46 2011 New Revision: 224559 URL: http://svn.freebsd.org/changeset/base/224559 Log: Split the debug stuff into two knobs. Modified: projects/portbuild/qmanager/packagebuild Modified: projects/portbuild/qmanager/packagebuild ============================================================================== --- projects/portbuild/qmanager/packagebuild Mon Aug 1 02:57:01 2011 (r224558) +++ projects/portbuild/qmanager/packagebuild Mon Aug 1 02:57:46 2011 (r224559) @@ -65,7 +65,8 @@ QMANAGER_RUNAWAY_PERCENTAGE = float( \ QMANAGER_RUNAWAY_THRESHOLD = int( \ config.get( 'QMANAGER_RUNAWAY_THRESHOLD' ) ) -DEBUG = False +DEBUG_PACKAGEBUILD = False +DEBUG_RETCODE = False categories = {} ports = {} @@ -480,7 +481,7 @@ class worker(threading.Thread): except RequestError, e: print "[MASTER] Error releasing job %s (%s): %s" % (pkg.name, pkg.id, e.value) - if DEBUG: + if DEBUG_RETCODE: print "[MASTER] got retcode %d from pkg %s" % (retcode, pkg.name) if retcode == 254: # Requeue soft failure at original priority @@ -578,7 +579,7 @@ def main(arch, branch, buildid, args): print "[MASTER] Remaining ports: %s" % ports.keys() (prio, job) = queue.get() - if DEBUG: + if DEBUG_PACKAGEBUILD: print "[MASTER] Job %s pulled from queue with prio %d" % ( job.name, prio ) if prio == SUCCESS_PRIO: print "[MASTER] Job %s succeeded" % job.name @@ -595,7 +596,7 @@ def main(arch, branch, buildid, args): # XXX MCL 20110421 completed_jobs = completed_jobs + 1 failed_jobs = failed_jobs + 1 - if DEBUG: + if DEBUG_PACKAGEBUILD: print "[MASTER] jobs: %d failed jobs out of %d:" % \ ( failed_jobs, completed_jobs ) if completed_jobs > QMANAGER_RUNAWAY_THRESHOLD and \ From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 08:34:00 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FD23106566B; Mon, 1 Aug 2011 08:34:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 665528FC13; Mon, 1 Aug 2011 08:34:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p718Y0Ih085068; Mon, 1 Aug 2011 08:34:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p718Y0VP085064; Mon, 1 Aug 2011 08:34:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108010834.p718Y0VP085064@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 08:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224567 - projects/hid/lib/libusbhid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 08:34:00 -0000 Author: mav Date: Mon Aug 1 08:34:00 2011 New Revision: 224567 URL: http://svn.freebsd.org/changeset/base/224567 Log: Add hid_get_report()/hid_set_report() functions to the libusbhid, wrapping respective IOCTLs. Modified: projects/hid/lib/libusbhid/data.c projects/hid/lib/libusbhid/usbhid.3 projects/hid/lib/libusbhid/usbhid.h Modified: projects/hid/lib/libusbhid/data.c ============================================================================== --- projects/hid/lib/libusbhid/data.c Mon Aug 1 08:22:40 2011 (r224566) +++ projects/hid/lib/libusbhid/data.c Mon Aug 1 08:34:00 2011 (r224567) @@ -29,10 +29,14 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include +#include +#include #include "usbhid.h" +#include "usbvar.h" int32_t hid_get_data(const void *p, const hid_item_t *h) @@ -114,3 +118,31 @@ hid_set_data(void *p, const hid_item_t * buf[offs + i] = (buf[offs + i] & (mask >> (i*8))) | ((data >> (i*8)) & 0xff); } + +int +hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + if (ioctl(fd, USB_GET_REPORT, &ugd) < 0) + return (errno); + return (0); +} + +int +hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + if (ioctl(fd, USB_SET_REPORT, &ugd) < 0) + return (errno); + return (0); +} Modified: projects/hid/lib/libusbhid/usbhid.3 ============================================================================== --- projects/hid/lib/libusbhid/usbhid.3 Mon Aug 1 08:22:40 2011 (r224566) +++ projects/hid/lib/libusbhid/usbhid.3 Mon Aug 1 08:34:00 2011 (r224567) @@ -44,7 +44,9 @@ .Nm hid_usage_in_page , .Nm hid_init , .Nm hid_get_data , -.Nm hid_set_data +.Nm hid_set_data , +.Nm hid_get_report , +.Nm hid_set_report .Nd USB HID access routines .Sh LIBRARY .Lb libusbhid @@ -84,6 +86,10 @@ .Fn hid_get_data "const void *data" "const hid_item_t *h" .Ft void .Fn hid_set_data "void *buf" "const hid_item_t *h" "int data" +.Ft int +.Fn hid_get_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" +.Ft int +.Fn hid_set_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" .Sh DESCRIPTION The .Nm @@ -105,6 +111,14 @@ Synchronous HID operation can be enabled If the second argument is zero synchronous HID operation is disabled. Else synchronous HID operation is enabled. The function returns a negative value on failure. +.Pp +.Fn hid_get_report +and +.Fn hid_set_report +functions allow to synchronously get and set specific report if device +supports it. +For devices with multiple report IDs, wanted ID should be provided in the +first byte of the buffer for both get and set. .Ss Descriptor Functions The report descriptor ID can be obtained by calling .Fn hid_get_report_id . Modified: projects/hid/lib/libusbhid/usbhid.h ============================================================================== --- projects/hid/lib/libusbhid/usbhid.h Mon Aug 1 08:22:40 2011 (r224566) +++ projects/hid/lib/libusbhid/usbhid.h Mon Aug 1 08:34:00 2011 (r224567) @@ -76,6 +76,7 @@ typedef struct hid_item { #define HID_PAGE(u) (((u) >> 16) & 0xffff) #define HID_USAGE(u) ((u) & 0xffff) +#define HID_HAS_GET_SET_REPORT 1 __BEGIN_DECLS @@ -104,5 +105,9 @@ int hid_parse_usage_page(const char *nam /* Extracting/insertion of data, data.c: */ int32_t hid_get_data(const void *p, const hid_item_t *h); void hid_set_data(void *p, const hid_item_t *h, int32_t data); +int hid_get_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); +int hid_set_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); __END_DECLS From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 10:57:54 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2FEB106564A; Mon, 1 Aug 2011 10:57:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A38D88FC0A; Mon, 1 Aug 2011 10:57:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71AvsMi093722; Mon, 1 Aug 2011 10:57:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71AvsDw093720; Mon, 1 Aug 2011 10:57:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011057.p71AvsDw093720@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 10:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224570 - projects/hid/lib/libusbhid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 10:57:54 -0000 Author: mav Date: Mon Aug 1 10:57:54 2011 New Revision: 224570 URL: http://svn.freebsd.org/changeset/base/224570 Log: Return error code via errno in new functions same as in some old. Modified: projects/hid/lib/libusbhid/data.c Modified: projects/hid/lib/libusbhid/data.c ============================================================================== --- projects/hid/lib/libusbhid/data.c Mon Aug 1 09:43:35 2011 (r224569) +++ projects/hid/lib/libusbhid/data.c Mon Aug 1 10:57:54 2011 (r224570) @@ -29,7 +29,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -128,9 +127,7 @@ hid_get_report(int fd, enum hid_kind k, ugd.ugd_data = hid_pass_ptr(data); ugd.ugd_maxlen = size; ugd.ugd_report_type = k + 1; - if (ioctl(fd, USB_GET_REPORT, &ugd) < 0) - return (errno); - return (0); + return (ioctl(fd, USB_GET_REPORT, &ugd)); } int @@ -142,7 +139,5 @@ hid_set_report(int fd, enum hid_kind k, ugd.ugd_data = hid_pass_ptr(data); ugd.ugd_maxlen = size; ugd.ugd_report_type = k + 1; - if (ioctl(fd, USB_SET_REPORT, &ugd) < 0) - return (errno); - return (0); + return (ioctl(fd, USB_SET_REPORT, &ugd)); } From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 12:04:12 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9607B10656D7; Mon, 1 Aug 2011 12:04:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 853538FC0A; Mon, 1 Aug 2011 12:04:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71C4CBp095771; Mon, 1 Aug 2011 12:04:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71C4CCD095768; Mon, 1 Aug 2011 12:04:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011204.p71C4CCD095768@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 12:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224572 - projects/hid/usr.bin/usbhidctl X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 12:04:12 -0000 Author: mav Date: Mon Aug 1 12:04:12 2011 New Revision: 224572 URL: http://svn.freebsd.org/changeset/base/224572 Log: Refactor usbhidctl to support items writing and and few other features. Modified: projects/hid/usr.bin/usbhidctl/usbhid.c projects/hid/usr.bin/usbhidctl/usbhidctl.1 Modified: projects/hid/usr.bin/usbhidctl/usbhid.c ============================================================================== --- projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 11:24:55 2011 (r224571) +++ projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 12:04:12 2011 (r224572) @@ -1,4 +1,3 @@ -/* $NetBSD: usbhid.c,v 1.14 2000/07/03 02:51:37 matt Exp $ */ /* $FreeBSD$ */ /* @@ -42,45 +41,120 @@ #include #include +struct variable { + char *name; + int instance; + int val; + struct hid_item h; + struct variable *next; +} *vars; + int verbose = 0; -int all = 0; int noname = 0; int hexdump = 0; +int wflag = 0; +int zflag = 0; -char **names; -int nnames; - -void prbits(int bits, char **strs, int n); -void usage(void); -void dumpitem(const char *label, struct hid_item *h); -void dumpitems(report_desc_t r); -void rev(struct hid_item **p); -void prdata(u_char *buf, struct hid_item *h); -void dumpdata(int f, report_desc_t r, int loop); -int gotname(char *n); +static void usage(void); +static void dumpitem(const char *label, struct hid_item *h); +static void dumpitems(report_desc_t r); +static void prdata(u_char *buf, struct hid_item *h); +static void dumpdata(int f, report_desc_t r, int loop); +static void writedata(int f, report_desc_t r); -int -gotname(char *n) +static void +parceargs(report_desc_t r, int all, int nnames, char **names) { - int i; - - for (i = 0; i < nnames; i++) - if (strcmp(names[i], n) == 0) - return 1; - return 0; -} - -void -prbits(int bits, char **strs, int n) -{ - int i; - - for(i = 0; i < n; i++, bits >>= 1) - if (strs[i*2]) - printf("%s%s", i == 0 ? "" : ", ", strs[i*2 + (bits&1)]); + struct hid_data *d; + struct hid_item h; + u_int32_t colls[100]; + int i, sp, instance; + char hname[1000], *tmp1, *tmp2; + struct variable *var, **pnext; + + pnext = &vars; + if (all) { + if (wflag) + errx(1, "Must not specify -w to read variables"); + sp = 0; + for (d = hid_start_parse(r, + 1<name, "%s:%s.%s:%s", + hid_usage_page(HID_PAGE(colls[sp])), + hid_usage_in_page(colls[sp]), + hid_usage_page(HID_PAGE(h.usage)), + hid_usage_in_page(h.usage)); + var->h = h; + *pnext = var; + pnext = &var->next; + } + hid_end_parse(d); + return; + } + for (i = 0; i < nnames; i++) { + var = malloc(sizeof(*var)); + memset(var, 0, sizeof(*var)); + tmp1 = tmp2 = strdup(names[i]); + strsep(&tmp2, "="); + var->name = strsep(&tmp1, "#"); + if (tmp1 != NULL) + var->instance = atoi(tmp1); + if (tmp2 != NULL) { + if (!wflag) + errx(1, "Must specify -w to write variables"); + var->val = atoi(tmp2); + } else + if (wflag) + errx(1, "Must not specify -w to read variables"); + *pnext = var; + pnext = &var->next; + + instance = 0; + sp = 0; + for (d = hid_start_parse(r, + 1<name) != 0) { + snprintf(hname, sizeof(hname), "%s:%s.%s:%s", + hid_usage_page(HID_PAGE(colls[sp])), + hid_usage_in_page(colls[sp]), + hid_usage_page(HID_PAGE(h.usage)), + hid_usage_in_page(h.usage)); + if (strcmp(hname, var->name) != 0) + continue; + } + if (var->instance != instance++) + continue; + var->h = h; + break; + } + hid_end_parse(d); + if (var->h.usage == 0) + errx(1, "Unknown usage '%s'", var->name); + } } -void +static void usage(void) { @@ -92,10 +166,14 @@ usage(void) " %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n", getprogname()); + fprintf(stderr, + " %s -f device " + "[-t tablefile] [-v] [-z] -w name=value\n", + getprogname()); exit(1); } -void +static void dumpitem(const char *label, struct hid_item *h) { if ((h->flags & HIO_CONST) && !verbose) @@ -134,7 +212,7 @@ hid_collection_type(int32_t type) return (num); } -void +static void dumpitems(report_desc_t r) { struct hid_data *d; @@ -174,23 +252,7 @@ dumpitems(report_desc_t r) printf("Total feature size %d bytes\n", size); } -void -rev(struct hid_item **p) -{ - struct hid_item *cur, *prev, *next; - - prev = 0; - cur = *p; - while(cur != 0) { - next = cur->next; - cur->next = prev; - prev = cur; - cur = next; - } - *p = prev; -} - -void +static void prdata(u_char *buf, struct hid_item *h) { u_int data; @@ -212,82 +274,162 @@ prdata(u_char *buf, struct hid_item *h) h->pos = pos; } -void +static void dumpdata(int f, report_desc_t rd, int loop) { - struct hid_data *d; - struct hid_item h, *hids, *n; - int r, dlen; + struct variable *var; + int dlen, havedata, i, match, r, rid, use_rid; u_char *dbuf; - u_int32_t colls[100]; - int sp = 0; - char namebuf[10000], *namep; + enum hid_kind kind; - hids = 0; - for (d = hid_start_parse(rd, 1<= 256) { + rid = 0; + kind++; + } + if (kind >= 3) + rid = -1; + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && + kind == var->h.kind) + break; + } + if (var == NULL) + continue; + } + dlen = hid_report_size(rd, kind < 3 ? kind : hid_input, rid); + if (dlen <= 0) continue; - h.next = hids; - h.collection = colls[sp]; - hids = malloc(sizeof *hids); - *hids = h; - } - hid_end_parse(d); - rev(&hids); - dlen = hid_report_size(rd, hid_input, -1); - dbuf = malloc(dlen); - if (!loop) - if (hid_set_immed(f, 1) < 0) { - if (errno == EOPNOTSUPP) - warnx("device does not support immediate mode, only changes reported."); - else - err(1, "USB_SET_IMMED"); + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + if (kind < 3) { + dbuf[0] = rid; + r = hid_get_report(f, kind, dbuf, dlen); + if (r < 0) + warn("hid_get_report(rid %d)", rid); + havedata = !r && (rid == 0 || dbuf[0] == rid); + if (rid != 0) + dbuf[0] = rid; + } else { + r = read(f, dbuf, dlen); + if (r < 1) + err(1, "read error"); + havedata = 1; } - do { - r = read(f, dbuf, dlen); - if (r < 1) { - err(1, "read error"); + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + use_rid ? dbuf[0] : 0, dlen); + if (havedata) { + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); + } + printf("\n"); } - for (n = hids; n; n = n->next) { - if (n->report_ID != 0 && dbuf[0] != n->report_ID) + match = 0; + for (var = vars; var; var = var->next) { + if ((kind < 3 ? kind : hid_input) != var->h.kind) + continue; + if (var->h.report_ID != 0 && + dbuf[0] != var->h.report_ID) continue; - namep = namebuf; - namep += sprintf(namep, "%s:%s.", - hid_usage_page(HID_PAGE(n->collection)), - hid_usage_in_page(n->collection)); - namep += sprintf(namep, "%s:%s", - hid_usage_page(HID_PAGE(n->usage)), - hid_usage_in_page(n->usage)); - if (all || gotname(namebuf)) { - if (!noname) - printf("%s=", namebuf); - prdata(dbuf, n); + match = 1; + if (!noname) + printf("%s=", var->name); + if (havedata) + prdata(dbuf, &var->h); + printf("\n"); + } + if (match) + printf("\n"); + free(dbuf); + } while (loop || kind < 3); +} + +static void +writedata(int f, report_desc_t rd) +{ + struct variable *var; + int dlen, i, r, rid; + u_char *dbuf; + enum hid_kind kind; + + kind = 0; + rid = 0; + for (kind = 0; kind < 3; kind ++) { + for (rid = 0; rid < 256; rid ++) { + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && kind == var->h.kind) + break; + } + if (var == NULL) + continue; + dlen = hid_report_size(rd, kind, rid); + if (dlen <= 0) + continue; + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + dbuf[0] = rid; + if (!zflag && hid_get_report(f, kind, dbuf, dlen) == 0) { + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); } + } else if (!zflag) { + warn("hid_get_report(rid %d)", rid); + if (verbose) { + printf("Can't get %s report %d (%d bytes). " + "Will be initialized with zeros.\n", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + } } - if (loop) + for (var = vars; var; var = var->next) { + if (rid != var->h.report_ID || kind != var->h.kind) + continue; + hid_set_data(dbuf, &var->h, var->val); + } + if (verbose) { + printf("Setting %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); - } while (loop); - free(dbuf); + } + r = hid_set_report(f, kind, dbuf, dlen); + if (r != 0) + warn("hid_set_report(rid %d)", rid); + free(dbuf); + } + } } int main(int argc, char **argv) { - int f; report_desc_t r; - char devnam[100], *dev = 0; + char *table = 0; + char devnam[100], *dev = NULL; + int f; + int all = 0; int ch; int repdump = 0; int loop = 0; - char *table = 0; - while ((ch = getopt(argc, argv, "af:lnrt:vx")) != -1) { + while ((ch = getopt(argc, argv, "af:lnrt:vwxz")) != -1) { switch(ch) { case 'a': all++; @@ -310,9 +452,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'w': + wflag = 1; + break; case 'x': hexdump = 1; break; + case 'z': + zflag = 1; + break; case '?': default: usage(); @@ -320,12 +468,10 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - if (dev == 0) + if (dev == NULL) usage(); - names = argv; - nnames = argc; - if (nnames == 0 && !all && !repdump) + if (argc == 0 && !all && !repdump) usage(); if (dev[0] != '/') { @@ -350,8 +496,13 @@ main(int argc, char **argv) printf("Report descriptor:\n"); dumpitems(r); } - if (nnames != 0 || all) - dumpdata(f, r, loop); + if (argc != 0 || all) { + parceargs(r, all, argc, argv); + if (wflag) + writedata(f, r); + else + dumpdata(f, r, loop); + } hid_dispose_report_desc(r); exit(0); Modified: projects/hid/usr.bin/usbhidctl/usbhidctl.1 ============================================================================== --- projects/hid/usr.bin/usbhidctl/usbhidctl.1 Mon Aug 1 11:24:55 2011 (r224571) +++ projects/hid/usr.bin/usbhidctl/usbhidctl.1 Mon Aug 1 12:04:12 2011 (r224572) @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 23, 2006 +.Dd August 01, 2011 .Dt USBHIDCTL 1 .Os .Sh NAME @@ -36,27 +36,51 @@ .Nd manipulate USB HID devices .Sh SYNOPSIS .Nm -.Op Fl a .Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl x +.Fl r +.Nm +.Fl f Ar device +.Op Fl t Ar table .Op Fl l -.Op Fl n -.Op Fl r +.Op Fl v +.Op Fl x +.Fl a +.Nm +.Fl f Ar device .Op Fl t Ar table +.Op Fl l +.Op Fl n .Op Fl v .Op Fl x -.Op Ar item ... +.Ar item ... +.Nm +.Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl z +.Fl w +.Ar item=value ... .Sh DESCRIPTION The .Nm -utility can be used to dump the state of a USB HID (Human Interface Device). +utility can be used to dump and modify the state of a USB HID (Human +Interface Device). Each named .Ar item is printed. +If the +.Fl w +flag is specified +.Nm +attempts to set the specified items to the given values. .Pp The options are as follows: .Bl -tag -width Ds .It Fl a -Show all items. +Show all items and their current values if device returns. .It Fl f Ar device Specify a path name for the device to operate on. .It Fl l @@ -69,8 +93,15 @@ Dump the report descriptor. Specify a path name for the HID usage table file. .It Fl v Be verbose. +.It Fl w +Change item values. +Only 'output' and 'feature' kinds can be set with this option. .It Fl x Dump data in hexadecimal as well as decimal. +.It Fl z +Reset reports to zero before processing +.Fl w +arguments. If not specified, current values will be requested from device. .El .Sh FILES .Pa /usr/share/misc/usb_hid_usages @@ -84,7 +115,3 @@ The .Nm command appeared in .Nx 1.4 . -.Sh BUGS -The -.Nm -utility cannot show nor set output and feature items. From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 13:17:59 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C83E5106566B; Mon, 1 Aug 2011 13:17:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B80AD8FC0A; Mon, 1 Aug 2011 13:17:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71DHxWV098417; Mon, 1 Aug 2011 13:17:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71DHxDn098415; Mon, 1 Aug 2011 13:17:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011317.p71DHxDn098415@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 13:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224573 - projects/hid/usr.bin/usbhidctl X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 13:18:00 -0000 Author: mav Date: Mon Aug 1 13:17:59 2011 New Revision: 224573 URL: http://svn.freebsd.org/changeset/base/224573 Log: Concatenate names of all collections on a stack to item name, not only the last one. This makes names match with ones used by usbhidaction. Modified: projects/hid/usr.bin/usbhidctl/usbhid.c Modified: projects/hid/usr.bin/usbhidctl/usbhid.c ============================================================================== --- projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 12:04:12 2011 (r224572) +++ projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 13:17:59 2011 (r224573) @@ -67,31 +67,38 @@ parceargs(report_desc_t r, int all, int { struct hid_data *d; struct hid_item h; - u_int32_t colls[100]; - int i, sp, instance; + char colls[1000]; char hname[1000], *tmp1, *tmp2; struct variable *var, **pnext; + int i, instance, cp, t; pnext = &vars; if (all) { if (wflag) errx(1, "Must not specify -w to read variables"); - sp = 0; + cp = 0; for (d = hid_start_parse(r, 1<name, "%s:%s.%s:%s", - hid_usage_page(HID_PAGE(colls[sp])), - hid_usage_in_page(colls[sp]), + asprintf(&var->name, "%s%s%s:%s", + colls, colls[0] != 0 ? "." : "", hid_usage_page(HID_PAGE(h.usage)), hid_usage_in_page(h.usage)); var->h = h; @@ -120,29 +127,37 @@ parceargs(report_desc_t r, int all, int pnext = &var->next; instance = 0; - sp = 0; + cp = 0; for (d = hid_start_parse(r, 1<name) != 0) { - snprintf(hname, sizeof(hname), "%s:%s.%s:%s", - hid_usage_page(HID_PAGE(colls[sp])), - hid_usage_in_page(colls[sp]), - hid_usage_page(HID_PAGE(h.usage)), - hid_usage_in_page(h.usage)); - if (strcmp(hname, var->name) != 0) + t = strlen(hname) - strlen(var->name); + if (t > 0) { + if (strcmp(hname + t, var->name) != 0) continue; - } + if (hname[t - 1] != '.') + continue; + } else if (strcmp(hname, var->name) != 0) + continue; if (var->instance != instance++) continue; var->h = h; @@ -150,7 +165,7 @@ parceargs(report_desc_t r, int all, int } hid_end_parse(d); if (var->h.usage == 0) - errx(1, "Unknown usage '%s'", var->name); + errx(1, "Unknown item '%s'", var->name); } } From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 13:40:48 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C7C2106566B; Mon, 1 Aug 2011 13:40:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CBBB8FC24; Mon, 1 Aug 2011 13:40:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71DemC4099146; Mon, 1 Aug 2011 13:40:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71DemM3099144; Mon, 1 Aug 2011 13:40:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011340.p71DemM3099144@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 13:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224574 - projects/hid/usr.bin/usbhidctl X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 13:40:48 -0000 Author: mav Date: Mon Aug 1 13:40:48 2011 New Revision: 224574 URL: http://svn.freebsd.org/changeset/base/224574 Log: Fix bug in previous change. Modified: projects/hid/usr.bin/usbhidctl/usbhid.c Modified: projects/hid/usr.bin/usbhidctl/usbhid.c ============================================================================== --- projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 13:17:59 2011 (r224573) +++ projects/hid/usr.bin/usbhidctl/usbhid.c Mon Aug 1 13:40:48 2011 (r224574) @@ -90,6 +90,9 @@ parceargs(report_desc_t r, int all, int if (tmp1 != NULL) { cp -= strlen(tmp1); tmp1[0] = 0; + } else { + cp = 0; + colls[0] = 0; } } if ((h.kind != hid_input && h.kind != hid_output && @@ -141,6 +144,9 @@ parceargs(report_desc_t r, int all, int if (tmp1 != NULL) { cp -= strlen(tmp1); tmp1[0] = 0; + } else { + cp = 0; + colls[0] = 0; } } if ((h.kind != hid_input && h.kind != hid_output && From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 13:46:48 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 317611065677; Mon, 1 Aug 2011 13:46:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 219F18FC14; Mon, 1 Aug 2011 13:46:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71DkmFf099412; Mon, 1 Aug 2011 13:46:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71Dkmps099410; Mon, 1 Aug 2011 13:46:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011346.p71Dkmps099410@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 13:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224576 - projects/hid/usr.bin/usbhidctl X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 13:46:48 -0000 Author: mav Date: Mon Aug 1 13:46:47 2011 New Revision: 224576 URL: http://svn.freebsd.org/changeset/base/224576 Log: Add SYNTAX section to manual page. Modified: projects/hid/usr.bin/usbhidctl/usbhidctl.1 Modified: projects/hid/usr.bin/usbhidctl/usbhidctl.1 ============================================================================== --- projects/hid/usr.bin/usbhidctl/usbhidctl.1 Mon Aug 1 13:41:38 2011 (r224575) +++ projects/hid/usr.bin/usbhidctl/usbhidctl.1 Mon Aug 1 13:46:47 2011 (r224576) @@ -103,6 +103,37 @@ Reset reports to zero before processing .Fl w arguments. If not specified, current values will be requested from device. .El +.Sh SYNTAX +.Nm +compares the names of items specified on the command line against the human +interface items reported by the USB device. +Each human interface item is mapped from its native form to a human readable +name, using the HID usage table file. +Command line items are compared with the generated item names, +and the USB HID device is operated on when a match is found. +.Pp +Each human interface item is named by the +.Qq page +it appears in, the +.Qq usage +within that page, and the list of +.Qq collections +containing the item. +Each collection in turn is also identified by page, and +the usage within that page. +.Pp +On the +.Nm +command line the page name is separated from the usage name with the character +.Sq Cm \&: . +The collections are separated by the character +.Sq Cm \&. . +.Pp +Some devices give the same name to more than one item. +.Nm +supports isolating each item by appending a +.Sq Cm \&# . +character and a decimal item instance number, starting at zero. .Sh FILES .Pa /usr/share/misc/usb_hid_usages The default HID usage table. From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 13:54:48 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D08B2106566C; Mon, 1 Aug 2011 13:54:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0A178FC08; Mon, 1 Aug 2011 13:54:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71DsmwY099673; Mon, 1 Aug 2011 13:54:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71Dsme7099671; Mon, 1 Aug 2011 13:54:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011354.p71Dsme7099671@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 13:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224577 - projects/hid/usr.bin/usbhidaction X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 13:54:48 -0000 Author: mav Date: Mon Aug 1 13:54:48 2011 New Revision: 224577 URL: http://svn.freebsd.org/changeset/base/224577 Log: Remove inaccurate detail. Modified: projects/hid/usr.bin/usbhidaction/usbhidaction.1 Modified: projects/hid/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- projects/hid/usr.bin/usbhidaction/usbhidaction.1 Mon Aug 1 13:46:47 2011 (r224576) +++ projects/hid/usr.bin/usbhidaction/usbhidaction.1 Mon Aug 1 13:54:48 2011 (r224577) @@ -99,8 +99,7 @@ a debounce value, and an action. There must be whitespace between the parts. .Pp The item names are similar to those used by -.Xr usbhidctl 1 , -but each part must be prefixed by its page name. +.Xr usbhidctl 1 . .Pp The value is simply a numeric value. When the item reports this value, From owner-svn-src-projects@FreeBSD.ORG Mon Aug 1 14:13:08 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7C25106567F; Mon, 1 Aug 2011 14:13:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE8E78FC1D; Mon, 1 Aug 2011 14:13:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p71ED8cO000416; Mon, 1 Aug 2011 14:13:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p71ED8Et000414; Mon, 1 Aug 2011 14:13:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108011413.p71ED8Et000414@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Aug 2011 14:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224578 - projects/hid/usr.bin/usbhidaction X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2011 14:13:08 -0000 Author: mav Date: Mon Aug 1 14:13:08 2011 New Revision: 224578 URL: http://svn.freebsd.org/changeset/base/224578 Log: Add support for # in item name and substring matches following usbhidctl. Modified: projects/hid/usr.bin/usbhidaction/usbhidaction.c Modified: projects/hid/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- projects/hid/usr.bin/usbhidaction/usbhidaction.c Mon Aug 1 13:54:48 2011 (r224577) +++ projects/hid/usr.bin/usbhidaction/usbhidaction.c Mon Aug 1 14:13:08 2011 (r224578) @@ -280,12 +280,11 @@ parse_conf(const char *conf, report_desc char *p; int line; char buf[SIZE], name[SIZE], value[SIZE], debounce[SIZE], action[SIZE]; - char usbuf[SIZE], coll[SIZE]; + char usbuf[SIZE], coll[SIZE], *tmp; struct command *cmd, *cmds; struct hid_data *d; struct hid_item h; - int u, lo, hi, range; - + int inst, cinst, u, lo, hi, range, t; f = fopen(conf, "r"); if (f == NULL) @@ -317,6 +316,12 @@ parse_conf(const char *conf, report_desc ", syntax error: %s", conf, line, buf); } } + tmp = strchr(name, '#'); + if (tmp != NULL) { + *tmp = 0; + inst = atoi(tmp + 1); + } else + inst = 0; cmd = malloc(sizeof *cmd); if (cmd == NULL) @@ -361,6 +366,7 @@ parse_conf(const char *conf, report_desc } coll[0] = 0; + cinst = 0; for (d = hid_start_parse(repd, 1 << hid_input, reportid); hid_get_item(d, &h); ) { if (verbose > 2) @@ -380,24 +386,29 @@ parse_conf(const char *conf, report_desc range = 0; } for (u = lo; u <= hi; u++) { - snprintf(usbuf, sizeof usbuf, "%s:%s", - hid_usage_page(HID_PAGE(u)), - hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; if (coll[0]) { snprintf(usbuf, sizeof usbuf, "%s.%s:%s", coll+1, - hid_usage_page(HID_PAGE(u)), + hid_usage_page(HID_PAGE(u)), + hid_usage_in_page(u)); + } else { + snprintf(usbuf, sizeof usbuf, + "%s:%s", + hid_usage_page(HID_PAGE(u)), hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", - usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; } + if (verbose > 2) + printf("usage %s\n", usbuf); + t = strlen(usbuf) - strlen(name); + if (t > 0) { + if (strcmp(usbuf + t, name)) + continue; + if (usbuf[t - 1] != '.') + continue; + } else if (strcmp(usbuf, name)) + continue; + if (inst == cinst++) + goto foundhid; } break; case hid_collection: From owner-svn-src-projects@FreeBSD.ORG Tue Aug 2 00:46:26 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F3EF106566B; Tue, 2 Aug 2011 00:46:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0CF8FC0A; Tue, 2 Aug 2011 00:46:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p720kQDJ019488; Tue, 2 Aug 2011 00:46:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p720kPo6019466; Tue, 2 Aug 2011 00:46:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108020046.p720kPo6019466@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Aug 2011 00:46:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224586 - in projects/hid: cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common contrib/bsnmp/snmp_usm contrib/gcc/cp contrib/top lib/libmemstat libexec/tftpd r... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2011 00:46:26 -0000 Author: mav Date: Tue Aug 2 00:46:25 2011 New Revision: 224586 URL: http://svn.freebsd.org/changeset/base/224586 Log: MFC Modified: projects/hid/cddl/contrib/opensolaris/cmd/ztest/ztest.c projects/hid/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c projects/hid/contrib/bsnmp/snmp_usm/snmp_usm.3 projects/hid/contrib/gcc/cp/ChangeLog projects/hid/contrib/gcc/cp/decl.c projects/hid/lib/libmemstat/libmemstat.3 projects/hid/lib/libmemstat/memstat.c projects/hid/lib/libmemstat/memstat.h projects/hid/lib/libmemstat/memstat_internal.h projects/hid/lib/libmemstat/memstat_malloc.c projects/hid/lib/libmemstat/memstat_uma.c projects/hid/libexec/tftpd/tftp-transfer.c projects/hid/libexec/tftpd/tftpd.8 projects/hid/release/doc/en_US.ISO8859-1/hardware/article.sgml projects/hid/share/man/man4/hptiop.4 projects/hid/share/man/man4/pcm.4 projects/hid/share/man/man4/smp.4 projects/hid/share/man/man9/taskqueue.9 projects/hid/share/man/man9/vfs_getopt.9 projects/hid/sys/amd64/amd64/machdep.c projects/hid/sys/cam/ata/ata_da.c projects/hid/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c projects/hid/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c projects/hid/sys/compat/linprocfs/linprocfs.c projects/hid/sys/dev/ath/ath_dfs/null/dfs_null.c projects/hid/sys/dev/ath/ath_hal/ah.h projects/hid/sys/dev/ath/ath_hal/ah_desc.h projects/hid/sys/dev/ath/ath_hal/ah_eeprom.h projects/hid/sys/dev/ath/ath_hal/ah_eeprom_9287.c projects/hid/sys/dev/ath/ath_hal/ah_eeprom_v14.c projects/hid/sys/dev/ath/ath_hal/ah_eeprom_v14.h projects/hid/sys/dev/ath/ath_hal/ah_eeprom_v4k.c projects/hid/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c projects/hid/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c projects/hid/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c projects/hid/sys/dev/ath/ath_hal/ar9002/ar9280.c projects/hid/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/hid/sys/dev/ath/if_ath.c projects/hid/sys/dev/ath/if_athvar.h projects/hid/sys/dev/hptiop/hptiop.c projects/hid/sys/fs/nfsclient/nfs_clvnops.c projects/hid/sys/fs/nfsserver/nfs_nfsdserv.c projects/hid/sys/i386/i386/machdep.c projects/hid/sys/kern/kern_conf.c projects/hid/sys/kern/kern_linker.c projects/hid/sys/kern/kern_lock.c projects/hid/sys/kern/subr_smp.c projects/hid/sys/net/if_lagg.c projects/hid/sys/netinet/ip_divert.c projects/hid/sys/pc98/pc98/machdep.c projects/hid/sys/powerpc/booke/locore.S projects/hid/sys/powerpc/conf/MPC85XX projects/hid/sys/powerpc/mpc85xx/atpic.c projects/hid/sys/vm/device_pager.c projects/hid/sys/vm/swap_pager.c projects/hid/sys/vm/swap_pager.h projects/hid/tools/tools/sysdoc/tunables.mdoc projects/hid/usr.bin/cpio/Makefile projects/hid/usr.bin/tar/Makefile projects/hid/usr.bin/unzip/unzip.1 projects/hid/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 projects/hid/usr.sbin/pw/pw_user.c Directory Properties: projects/hid/ (props changed) projects/hid/cddl/contrib/opensolaris/ (props changed) projects/hid/contrib/bind9/ (props changed) projects/hid/contrib/binutils/ (props changed) projects/hid/contrib/bzip2/ (props changed) projects/hid/contrib/compiler-rt/ (props changed) projects/hid/contrib/dialog/ (props changed) projects/hid/contrib/ee/ (props changed) projects/hid/contrib/expat/ (props changed) projects/hid/contrib/file/ (props changed) projects/hid/contrib/gcc/ (props changed) projects/hid/contrib/gdb/ (props changed) projects/hid/contrib/gdtoa/ (props changed) projects/hid/contrib/gnu-sort/ (props changed) projects/hid/contrib/groff/ (props changed) projects/hid/contrib/less/ (props changed) projects/hid/contrib/libpcap/ (props changed) projects/hid/contrib/libstdc++/ (props changed) projects/hid/contrib/llvm/ (props changed) projects/hid/contrib/llvm/tools/clang/ (props changed) projects/hid/contrib/ncurses/ (props changed) projects/hid/contrib/netcat/ (props changed) projects/hid/contrib/ntp/ (props changed) projects/hid/contrib/one-true-awk/ (props changed) projects/hid/contrib/openbsm/ (props changed) projects/hid/contrib/openpam/ (props changed) projects/hid/contrib/pf/ (props changed) projects/hid/contrib/sendmail/ (props changed) projects/hid/contrib/tcpdump/ (props changed) projects/hid/contrib/tcsh/ (props changed) projects/hid/contrib/tnftp/ (props changed) projects/hid/contrib/top/ (props changed) projects/hid/contrib/top/install-sh (props changed) projects/hid/contrib/tzcode/stdtime/ (props changed) projects/hid/contrib/tzcode/zic/ (props changed) projects/hid/contrib/tzdata/ (props changed) projects/hid/contrib/wpa/ (props changed) projects/hid/contrib/xz/ (props changed) projects/hid/crypto/openssh/ (props changed) projects/hid/crypto/openssl/ (props changed) projects/hid/gnu/lib/ (props changed) projects/hid/gnu/usr.bin/binutils/ (props changed) projects/hid/gnu/usr.bin/cc/cc_tools/ (props changed) projects/hid/gnu/usr.bin/gdb/ (props changed) projects/hid/lib/libc/ (props changed) projects/hid/lib/libc/stdtime/ (props changed) projects/hid/lib/libutil/ (props changed) projects/hid/lib/libz/ (props changed) projects/hid/sbin/ (props changed) projects/hid/sbin/ipfw/ (props changed) projects/hid/share/mk/bsd.arch.inc.mk (props changed) projects/hid/share/zoneinfo/ (props changed) projects/hid/sys/ (props changed) projects/hid/sys/amd64/include/xen/ (props changed) projects/hid/sys/boot/ (props changed) projects/hid/sys/boot/i386/efi/ (props changed) projects/hid/sys/boot/ia64/efi/ (props changed) projects/hid/sys/boot/ia64/ski/ (props changed) projects/hid/sys/boot/powerpc/boot1.chrp/ (props changed) projects/hid/sys/boot/powerpc/ofw/ (props changed) projects/hid/sys/cddl/contrib/opensolaris/ (props changed) projects/hid/sys/conf/ (props changed) projects/hid/sys/contrib/dev/acpica/ (props changed) projects/hid/sys/contrib/octeon-sdk/ (props changed) projects/hid/sys/contrib/pf/ (props changed) projects/hid/sys/contrib/x86emu/ (props changed) projects/hid/usr.bin/calendar/ (props changed) projects/hid/usr.bin/csup/ (props changed) projects/hid/usr.bin/procstat/ (props changed) projects/hid/usr.sbin/ndiscvt/ (props changed) projects/hid/usr.sbin/rtadvctl/ (props changed) projects/hid/usr.sbin/rtadvd/ (props changed) projects/hid/usr.sbin/zic/ (props changed) Modified: projects/hid/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- projects/hid/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Aug 2 00:46:25 2011 (r224586) @@ -205,6 +205,7 @@ typedef struct ztest_od { */ typedef struct ztest_ds { objset_t *zd_os; + rwlock_t zd_zilog_lock; zilog_t *zd_zilog; uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ @@ -238,6 +239,7 @@ ztest_func_t ztest_dmu_commit_callbacks; ztest_func_t ztest_zap; ztest_func_t ztest_zap_parallel; ztest_func_t ztest_zil_commit; +ztest_func_t ztest_zil_remount; ztest_func_t ztest_dmu_read_write_zcopy; ztest_func_t ztest_dmu_objset_create_destroy; ztest_func_t ztest_dmu_prealloc; @@ -273,6 +275,7 @@ ztest_info_t ztest_info[] = { { ztest_zap_parallel, 100, &zopt_always }, { ztest_split_pool, 1, &zopt_always }, { ztest_zil_commit, 1, &zopt_incessant }, + { ztest_zil_remount, 1, &zopt_sometimes }, { ztest_dmu_read_write_zcopy, 1, &zopt_often }, { ztest_dmu_objset_create_destroy, 1, &zopt_often }, { ztest_dsl_prop_get_set, 1, &zopt_often }, @@ -986,6 +989,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t * zd->zd_seq = 0; dmu_objset_name(os, zd->zd_name); + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) @@ -1965,6 +1969,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; + (void) rw_rdlock(&zd->zd_zilog_lock); + switch (io_type) { case ZTEST_IO_WRITE_TAG: @@ -2000,6 +2006,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object break; } + (void) rw_unlock(&zd->zd_zilog_lock); + umem_free(data, blocksize); } @@ -2054,6 +2062,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ { zilog_t *zilog = zd->zd_zilog; + (void) rw_rdlock(&zd->zd_zilog_lock); + zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); /* @@ -2065,6 +2075,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); zd->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); + + (void) rw_unlock(&zd->zd_zilog_lock); +} + +/* + * This function is designed to simulate the operations that occur during a + * mount/unmount operation. We hold the dataset across these operations in an + * attempt to expose any implicit assumptions about ZIL management. + */ +/* ARGSUSED */ +void +ztest_zil_remount(ztest_ds_t *zd, uint64_t id) +{ + objset_t *os = zd->zd_os; + + (void) rw_wrlock(&zd->zd_zilog_lock); + + /* zfsvfs_teardown() */ + zil_close(zd->zd_zilog); + + /* zfsvfs_setup() */ + VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); + zil_replay(os, zd, ztest_replay_vector); + + (void) rw_unlock(&zd->zd_zilog_lock); } /* Modified: projects/hid/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- projects/hid/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 2 00:46:25 2011 (r224586) @@ -4289,7 +4289,8 @@ zfs_jail(zfs_handle_t *zhp, int jailid, libzfs_handle_t *hdl = zhp->zfs_hdl; zfs_cmd_t zc = { 0 }; char errbuf[1024]; - int cmd, ret; + unsigned long cmd; + int ret; if (attach) { (void) snprintf(errbuf, sizeof (errbuf), Modified: projects/hid/contrib/bsnmp/snmp_usm/snmp_usm.3 ============================================================================== --- projects/hid/contrib/bsnmp/snmp_usm/snmp_usm.3 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/contrib/bsnmp/snmp_usm/snmp_usm.3 Tue Aug 2 00:46:25 2011 (r224586) @@ -115,7 +115,7 @@ allowed. This column is used to create new USM user entries or delete existing ones from the table. .El -.EL +.El .Sh FILES .Bl -tag -width "XXXXXXXXX" .It Pa /usr/share/snmp/defs/usm_tree.def Modified: projects/hid/contrib/gcc/cp/ChangeLog ============================================================================== --- projects/hid/contrib/gcc/cp/ChangeLog Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/contrib/gcc/cp/ChangeLog Tue Aug 2 00:46:25 2011 (r224586) @@ -1,3 +1,9 @@ +2007-09-29 Jason Merrill + + PR c++/33094 + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member + constant to not have DECL_EXTERNAL if it's file-local. + 2007-08-24 Jakub Jelinek PR c++/31941 Modified: projects/hid/contrib/gcc/cp/decl.c ============================================================================== --- projects/hid/contrib/gcc/cp/decl.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/contrib/gcc/cp/decl.c Tue Aug 2 00:46:25 2011 (r224586) @@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t /* An in-class declaration of a static data member should be external; it is only a declaration, and not a definition. */ if (init == NULL_TREE) - gcc_assert (DECL_EXTERNAL (decl)); + gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)); } /* We don't create any RTL for local variables. */ Modified: projects/hid/lib/libmemstat/libmemstat.3 ============================================================================== --- projects/hid/lib/libmemstat/libmemstat.3 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/libmemstat.3 Tue Aug 2 00:46:25 2011 (r224586) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 27, 2005 +.Dd July 21, 2011 .Dt LIBMEMSTAT 3 .Os .Sh NAME @@ -412,10 +412,6 @@ values of .Er EACCES or .Er EPERM . -.It Dv MEMSTAT_ERROR_TOOMANYCPUS -Returned if the compile-time limit on the number of CPUs in -.Nm -is lower than the number of CPUs returned by a statistics data source. .It Dv MEMSTAT_ERROR_DATAERROR Returned if .Nm Modified: projects/hid/lib/libmemstat/memstat.c ============================================================================== --- projects/hid/lib/libmemstat/memstat.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/memstat.c Tue Aug 2 00:46:25 2011 (r224586) @@ -49,8 +49,6 @@ memstat_strerror(int error) return ("Version mismatch"); case MEMSTAT_ERROR_PERMISSION: return ("Permission denied"); - case MEMSTAT_ERROR_TOOMANYCPUS: - return ("Too many CPUs"); case MEMSTAT_ERROR_DATAERROR: return ("Data format error"); case MEMSTAT_ERROR_KVM: @@ -99,6 +97,8 @@ _memstat_mtl_empty(struct memory_type_li struct memory_type *mtp; while ((mtp = LIST_FIRST(&list->mtl_list))) { + free(mtp->mt_percpu_alloc); + free(mtp->mt_percpu_cache); LIST_REMOVE(mtp, mt_list); free(mtp); } @@ -147,7 +147,7 @@ memstat_mtl_find(struct memory_type_list */ struct memory_type * _memstat_mt_allocate(struct memory_type_list *list, int allocator, - const char *name) + const char *name, int maxcpus) { struct memory_type *mtp; @@ -158,6 +158,10 @@ _memstat_mt_allocate(struct memory_type_ bzero(mtp, sizeof(*mtp)); mtp->mt_allocator = allocator; + mtp->mt_percpu_alloc = malloc(sizeof(struct mt_percpu_alloc_s) * + maxcpus); + mtp->mt_percpu_cache = malloc(sizeof(struct mt_percpu_cache_s) * + maxcpus); strlcpy(mtp->mt_name, name, MEMTYPE_MAXNAME); LIST_INSERT_HEAD(&list->mtl_list, mtp, mt_list); return (mtp); @@ -171,7 +175,7 @@ _memstat_mt_allocate(struct memory_type_ * libmemstat(3) internal function. */ void -_memstat_mt_reset_stats(struct memory_type *mtp) +_memstat_mt_reset_stats(struct memory_type *mtp, int maxcpus) { int i; @@ -193,7 +197,7 @@ _memstat_mt_reset_stats(struct memory_ty mtp->mt_zonefree = 0; mtp->mt_kegfree = 0; - for (i = 0; i < MEMSTAT_MAXCPU; i++) { + for (i = 0; i < maxcpus; i++) { mtp->mt_percpu_alloc[i].mtp_memalloced = 0; mtp->mt_percpu_alloc[i].mtp_memfreed = 0; mtp->mt_percpu_alloc[i].mtp_numallocs = 0; Modified: projects/hid/lib/libmemstat/memstat.h ============================================================================== --- projects/hid/lib/libmemstat/memstat.h Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/memstat.h Tue Aug 2 00:46:25 2011 (r224586) @@ -30,12 +30,6 @@ #define _MEMSTAT_H_ /* - * Number of CPU slots in library-internal data structures. This should be - * at least the value of MAXCPU from param.h. - */ -#define MEMSTAT_MAXCPU 32 - -/* * Amount of caller data to maintain for each caller data slot. Applications * must not request more than this number of caller save data, or risk * corrupting internal libmemstat(3) data structures. A compile time check @@ -70,7 +64,6 @@ #define MEMSTAT_ERROR_NOMEMORY 1 /* Out of memory. */ #define MEMSTAT_ERROR_VERSION 2 /* Unsupported version. */ #define MEMSTAT_ERROR_PERMISSION 3 /* Permission denied. */ -#define MEMSTAT_ERROR_TOOMANYCPUS 4 /* Too many CPUs. */ #define MEMSTAT_ERROR_DATAERROR 5 /* Error in stat data. */ #define MEMSTAT_ERROR_KVM 6 /* See kvm_geterr() for err. */ #define MEMSTAT_ERROR_KVM_NOSYMBOL 7 /* Symbol not available. */ Modified: projects/hid/lib/libmemstat/memstat_internal.h ============================================================================== --- projects/hid/lib/libmemstat/memstat_internal.h Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/memstat_internal.h Tue Aug 2 00:46:25 2011 (r224586) @@ -92,7 +92,7 @@ struct memory_type { * Per-CPU measurements fall into two categories: per-CPU allocation, * and per-CPU cache state. */ - struct { + struct mt_percpu_alloc_s { uint64_t mtp_memalloced;/* Per-CPU mt_memalloced. */ uint64_t mtp_memfreed; /* Per-CPU mt_memfreed. */ uint64_t mtp_numallocs; /* Per-CPU mt_numallocs. */ @@ -100,11 +100,11 @@ struct memory_type { uint64_t mtp_sizemask; /* Per-CPU mt_sizemask. */ void *mtp_caller_pointer[MEMSTAT_MAXCALLER]; uint64_t mtp_caller_uint64[MEMSTAT_MAXCALLER]; - } mt_percpu_alloc[MEMSTAT_MAXCPU]; + } *mt_percpu_alloc; - struct { + struct mt_percpu_cache_s { uint64_t mtp_free; /* Per-CPU cache free items. */ - } mt_percpu_cache[MEMSTAT_MAXCPU]; + } *mt_percpu_cache; LIST_ENTRY(memory_type) mt_list; /* List of types. */ }; @@ -119,7 +119,8 @@ struct memory_type_list { void _memstat_mtl_empty(struct memory_type_list *list); struct memory_type *_memstat_mt_allocate(struct memory_type_list *list, - int allocator, const char *name); -void _memstat_mt_reset_stats(struct memory_type *mtp); + int allocator, const char *name, int maxcpus); +void _memstat_mt_reset_stats(struct memory_type *mtp, + int maxcpus); #endif /* !_MEMSTAT_INTERNAL_H_ */ Modified: projects/hid/lib/libmemstat/memstat_malloc.c ============================================================================== --- projects/hid/lib/libmemstat/memstat_malloc.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/memstat_malloc.c Tue Aug 2 00:46:25 2011 (r224586) @@ -96,11 +96,6 @@ retry: return (-1); } - if (maxcpus > MEMSTAT_MAXCPU) { - list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; - return (-1); - } - size = sizeof(count); if (sysctlbyname("kern.malloc_count", &count, &size, NULL, 0) < 0) { if (errno == EACCES || errno == EPERM) @@ -160,12 +155,6 @@ retry: return (-1); } - if (mtshp->mtsh_maxcpus > MEMSTAT_MAXCPU) { - list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; - free(buffer); - return (-1); - } - /* * For the remainder of this function, we are quite trusting about * the layout of structures and sizes, since we've determined we have @@ -184,7 +173,7 @@ retry: mtp = NULL; if (mtp == NULL) mtp = _memstat_mt_allocate(list, ALLOCATOR_MALLOC, - mthp->mth_name); + mthp->mth_name, maxcpus); if (mtp == NULL) { _memstat_mtl_empty(list); free(buffer); @@ -195,7 +184,7 @@ retry: /* * Reset the statistics on a current node. */ - _memstat_mt_reset_stats(mtp); + _memstat_mt_reset_stats(mtp, maxcpus); for (j = 0; j < maxcpus; j++) { mtsp = (struct malloc_type_stats *)p; @@ -295,7 +284,7 @@ memstat_kvm_malloc(struct memory_type_li void *kmemstatistics; int hint_dontsearch, j, mp_maxcpus, ret; char name[MEMTYPE_MAXNAME]; - struct malloc_type_stats mts[MEMSTAT_MAXCPU], *mtsp; + struct malloc_type_stats *mts, *mtsp; struct malloc_type_internal *mtip; struct malloc_type type, *typep; kvm_t *kvm; @@ -322,11 +311,6 @@ memstat_kvm_malloc(struct memory_type_li return (-1); } - if (mp_maxcpus > MEMSTAT_MAXCPU) { - list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; - return (-1); - } - ret = kread_symbol(kvm, X_KMEMSTATISTICS, &kmemstatistics, sizeof(kmemstatistics), 0); if (ret != 0) { @@ -334,10 +318,17 @@ memstat_kvm_malloc(struct memory_type_li return (-1); } + mts = malloc(sizeof(struct malloc_type_stats) * mp_maxcpus); + if (mts == NULL) { + list->mtl_error = MEMSTAT_ERROR_NOMEMORY; + return (-1); + } + for (typep = kmemstatistics; typep != NULL; typep = type.ks_next) { ret = kread(kvm, typep, &type, sizeof(type), 0); if (ret != 0) { _memstat_mtl_empty(list); + free(mts); list->mtl_error = ret; return (-1); } @@ -345,6 +336,7 @@ memstat_kvm_malloc(struct memory_type_li MEMTYPE_MAXNAME); if (ret != 0) { _memstat_mtl_empty(list); + free(mts); list->mtl_error = ret; return (-1); } @@ -358,6 +350,7 @@ memstat_kvm_malloc(struct memory_type_li sizeof(struct malloc_type_stats), 0); if (ret != 0) { _memstat_mtl_empty(list); + free(mts); list->mtl_error = ret; return (-1); } @@ -368,9 +361,10 @@ memstat_kvm_malloc(struct memory_type_li mtp = NULL; if (mtp == NULL) mtp = _memstat_mt_allocate(list, ALLOCATOR_MALLOC, - name); + name, mp_maxcpus); if (mtp == NULL) { _memstat_mtl_empty(list); + free(mts); list->mtl_error = MEMSTAT_ERROR_NOMEMORY; return (-1); } @@ -379,7 +373,7 @@ memstat_kvm_malloc(struct memory_type_li * This logic is replicated from kern_malloc.c, and should * be kept in sync. */ - _memstat_mt_reset_stats(mtp); + _memstat_mt_reset_stats(mtp, mp_maxcpus); for (j = 0; j < mp_maxcpus; j++) { mtsp = &mts[j]; mtp->mt_memalloced += mtsp->mts_memalloced; Modified: projects/hid/lib/libmemstat/memstat_uma.c ============================================================================== --- projects/hid/lib/libmemstat/memstat_uma.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/lib/libmemstat/memstat_uma.c Tue Aug 2 00:46:25 2011 (r224586) @@ -79,7 +79,7 @@ memstat_sysctl_uma(struct memory_type_li struct uma_type_header *uthp; struct uma_percpu_stat *upsp; struct memory_type *mtp; - int count, hint_dontsearch, i, j, maxcpus; + int count, hint_dontsearch, i, j, maxcpus, maxid; char *buffer, *p; size_t size; @@ -93,24 +93,19 @@ memstat_sysctl_uma(struct memory_type_li * from the header. */ retry: - size = sizeof(maxcpus); - if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &size, NULL, 0) < 0) { + size = sizeof(maxid); + if (sysctlbyname("kern.smp.maxid", &maxid, &size, NULL, 0) < 0) { if (errno == EACCES || errno == EPERM) list->mtl_error = MEMSTAT_ERROR_PERMISSION; else list->mtl_error = MEMSTAT_ERROR_DATAERROR; return (-1); } - if (size != sizeof(maxcpus)) { + if (size != sizeof(maxid)) { list->mtl_error = MEMSTAT_ERROR_DATAERROR; return (-1); } - if (maxcpus > MEMSTAT_MAXCPU) { - list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; - return (-1); - } - size = sizeof(count); if (sysctlbyname("vm.zone_count", &count, &size, NULL, 0) < 0) { if (errno == EACCES || errno == EPERM) @@ -125,7 +120,7 @@ retry: } size = sizeof(*uthp) + count * (sizeof(*uthp) + sizeof(*upsp) * - maxcpus); + (maxid + 1)); buffer = malloc(size); if (buffer == NULL) { @@ -170,12 +165,6 @@ retry: return (-1); } - if (ushp->ush_maxcpus > MEMSTAT_MAXCPU) { - list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; - free(buffer); - return (-1); - } - /* * For the remainder of this function, we are quite trusting about * the layout of structures and sizes, since we've determined we have @@ -194,7 +183,7 @@ retry: mtp = NULL; if (mtp == NULL) mtp = _memstat_mt_allocate(list, ALLOCATOR_UMA, - uthp->uth_name); + uthp->uth_name, maxid + 1); if (mtp == NULL) { _memstat_mtl_empty(list); free(buffer); @@ -205,7 +194,7 @@ retry: /* * Reset the statistics on a current node. */ - _memstat_mt_reset_stats(mtp); + _memstat_mt_reset_stats(mtp, maxid + 1); mtp->mt_numallocs = uthp->uth_allocs; mtp->mt_numfrees = uthp->uth_frees; @@ -398,7 +387,7 @@ memstat_kvm_uma(struct memory_type_list mtp = NULL; if (mtp == NULL) mtp = _memstat_mt_allocate(list, ALLOCATOR_UMA, - name); + name, mp_maxid + 1); if (mtp == NULL) { free(ucp_array); _memstat_mtl_empty(list); @@ -408,7 +397,7 @@ memstat_kvm_uma(struct memory_type_list /* * Reset the statistics on a current node. */ - _memstat_mt_reset_stats(mtp); + _memstat_mt_reset_stats(mtp, mp_maxid + 1); mtp->mt_numallocs = uz.uz_allocs; mtp->mt_numfrees = uz.uz_frees; mtp->mt_failures = uz.uz_fails; Modified: projects/hid/libexec/tftpd/tftp-transfer.c ============================================================================== --- projects/hid/libexec/tftpd/tftp-transfer.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/libexec/tftpd/tftp-transfer.c Tue Aug 2 00:46:25 2011 (r224586) @@ -129,14 +129,16 @@ tftp_send(int peer, uint16_t *block, str (*block)++; if (oldblock > *block) { if (options[OPT_ROLLOVER].o_request == NULL) { - tftp_log(LOG_ERR, - "Block rollover but not allowed."); - send_error(peer, EBADOP); - gettimeofday(&(ts->tstop), NULL); - return; + /* + * "rollover" option not specified in + * tftp client. Default to rolling block + * counter to 0. + */ + *block = 0; + } else { + *block = atoi(options[OPT_ROLLOVER].o_request); } - *block = atoi(options[OPT_ROLLOVER].o_request); ts->rollovers++; } gettimeofday(&(ts->tstop), NULL); @@ -196,14 +198,16 @@ tftp_receive(int peer, uint16_t *block, (*block)++; if (oldblock > *block) { if (options[OPT_ROLLOVER].o_request == NULL) { - tftp_log(LOG_ERR, - "Block rollover but not allowed."); - send_error(peer, EBADOP); - gettimeofday(&(ts->tstop), NULL); - return; + /* + * "rollover" option not specified in + * tftp client. Default to rolling block + * counter to 0. + */ + *block = 0; + } else { + *block = atoi(options[OPT_ROLLOVER].o_request); } - *block = atoi(options[OPT_ROLLOVER].o_request); ts->rollovers++; } Modified: projects/hid/libexec/tftpd/tftpd.8 ============================================================================== --- projects/hid/libexec/tftpd/tftpd.8 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/libexec/tftpd/tftpd.8 Tue Aug 2 00:46:25 2011 (r224586) @@ -300,8 +300,15 @@ and .Xr tftp 1 code to support RFC2348. .Sh NOTES -Files larger than 33488896 octets (65535 blocks) cannot be transferred -without client and server supporting the TFTP blocksize option (RFC2348), +Files larger than 33,553,919 octets (65535 blocks, last one <512 +octets) cannot be correctly transferred without client and server +supporting blocksize negotiation (RFCs 2347 and 2348), or the non-standard TFTP rollover option. +As a kludge, +.Nm +accepts a sequence of block number which wrap to zero after 65535, +even if the rollover option is not specified. .Pp -Many tftp clients will not transfer files over 16744448 octets (32767 blocks). +Many tftp clients will not transfer files over 16,776,703 octets +(32767 blocks), as they incorrectly count the block number using +a signed rather than unsigned 16-bit integer. Modified: projects/hid/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- projects/hid/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/release/doc/en_US.ISO8859-1/hardware/article.sgml Tue Aug 2 00:46:25 2011 (r224586) @@ -195,11 +195,9 @@ resources between logical processors within the same CPU. Because this naive scheduling can result in suboptimal performance, under certain circumstances it may be useful to - disable the logical processors with the the - machdep.hlt_logical_cpus sysctl variable. - It is also possible to halt any CPU in the idle loop with the - machdep.hlt_cpus sysctl variable. The - &man.smp.4; manual page has more details. + disable the logical processors with the + machdep.hyperthreading_allowed tunable. + The &man.smp.4; manual page has more details. &os; will take advantage of Physical Address Extensions (PAE) support on CPUs that support this feature. A kernel Modified: projects/hid/share/man/man4/hptiop.4 ============================================================================== --- projects/hid/share/man/man4/hptiop.4 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/share/man/man4/hptiop.4 Tue Aug 2 00:46:25 2011 (r224586) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2007 +.Dd August 1, 2011 .Dt HPTIOP 4 .Os .Sh NAME @@ -60,6 +60,10 @@ driver supports the following SAS and SA .It HighPoint RocketRAID 4320 .It +HighPoint RocketRAID 4321 +.It +HighPoint RocketRAID 4322 +.It HighPoint RocketRAID 3220 .It HighPoint RocketRAID 3320 Modified: projects/hid/share/man/man4/pcm.4 ============================================================================== --- projects/hid/share/man/man4/pcm.4 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/share/man/man4/pcm.4 Tue Aug 2 00:46:25 2011 (r224586) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 1998, Luigi Rizzo +.\" Copyright (c) 2009-2011 Joel Dahl .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 13, 2009 +.Dd July 31, 2011 .Dt SOUND 4 .Os .Sh NAME @@ -41,7 +41,122 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device sound" .Ed +.Sh DESCRIPTION +The +.Nm +driver is the main component of the +.Fx +sound system. +It works in conjunction with a bridge device driver on supported devices +and provides PCM audio record and playback once it attaches. +Each bridge device driver supports a specific set of audio chipsets and +needs to be enabled together with the +.Nm +driver. +PCI and ISA PnP audio devices identify themselves so users are usually not +required to add anything to +.Pa /boot/device.hints . +.Pp +Some of the main features of the +.Nm +driver are: multichannel audio, per-application +volume control, dynamic mixing through virtual sound channels, true full +duplex operation, bit perfect audio, rate conversion and low latency +modes. +.Pp +The +.Nm +driver is enabled by default, along with several bridge device drivers. +Those not enabled by default can be loaded during runtime with +.Xr kldload 8 +or during boot via +.Xr loader.conf 5 . +The following bridge device drivers are available: +.Pp +.Bl -bullet -compact +.It +.Xr snd_ad1816 4 +.It +.Xr snd_ai2s 4 (enabled by default on powerpc) +.It +.Xr snd_als4000 4 +.It +.Xr snd_atiixp 4 +.It +.Xr snd_audiocs 4 (enabled by default on sparc64) +.It +.Xr snd_cmi 4 +.It +.Xr snd_cs4281 4 +.It +.Xr snd_csa 4 +.It +.Xr snd_davbus 4 (enabled by default on powerpc) +.It +.Xr snd_ds1 4 +.It +.Xr snd_emu10k1 4 +.It +.Xr snd_emu10kx 4 +.It +.Xr snd_envy24 4 +.It +.Xr snd_envy24ht 4 +.It +.Xr snd_es137x 4 (enabled by default on amd64, i386, sparc64) +.It +.Xr snd_ess 4 +.It +.Xr snd_fm801 4 +.It +.Xr snd_gusc 4 +.It +.Xr snd_hda 4 (enabled by default on amd64, i386) +.It +.Xr snd_ich 4 (enabled by default on amd64, i386) +.It +.Xr snd_maestro 4 +.It +.Xr snd_maestro3 4 +.It +.Xr snd_mss 4 +.It +.Xr snd_neomagic 4 +.It +snd_sb16 +.It +snd_sb8 +.It +.Xr snd_sbc 4 +.It +.Xr snd_solo 4 +.It +.Xr snd_spicds 4 +.It +.Xr snd_t4dwave 4 (enabled by default on sparc64) +.It +.Xr snd_uaudio 4 (enabled by default on amd64, i386, powerpc, sparc64) +.It +.Xr snd_via8233 4 (enabled by default on amd64, i386) +.It +.Xr snd_via82c686 4 +.It +.Xr snd_vibes 4 +.El .Pp +Refer to the manual page for each bridge device driver for driver specific +settings and information. +.Ss Legacy Hardware +For old legacy +.Tn ISA +cards, the driver looks for +.Tn MSS +cards at addresses +.Dv 0x530 +and +.Dv 0x604 . +These values can be overridden in +.Pa /boot/device.hints . Non-PnP sound cards require the following lines in .Xr device.hints 5 : .Bd -literal -offset indent @@ -50,33 +165,6 @@ hint.pcm.0.irq="5" hint.pcm.0.drq="1" hint.pcm.0.flags="0x0" .Ed -.Sh DESCRIPTION -The -.Nm -driver provides support for -.Tn PCM -audio play and capture. -This driver also supports various -.Tn PCI , -.Tn ISA , -.Tn WSS/MSS -compatible -sound cards, AC97 mixer and High Definition Audio. -Once the -.Nm -driver attaches, supported devices provide audio record and -playback channels. -The -.Fx -sound system provides dynamic mixing -.Dq VCHAN -and rate conversion -.Dq soft formats . -True full duplex operation is available on most sound cards. -.Pp -If the sound card is supported by a bridge driver, the -.Nm -driver works in conjunction with the bridge driver. .Pp Apart from the usual parameters, the flags field is used to specify the secondary @@ -85,24 +173,6 @@ channel (generally used for capture in f Flags are set to 0 for cards not using a secondary .Tn DMA channel, or to 0x10 + C to specify channel C. -.Pp -The driver does its best to recognize the installed hardware and drive -it correctly so the user is not required to add several lines in -.Pa /boot/device.hints . -For -.Tn PCI -and -.Tn ISA -.Tn PnP -cards this is actually easy -since they identify themselves. -For legacy -.Tn ISA -cards, the driver looks for -.Tn MSS -cards at addresses 0x530 and 0x604 (unless overridden -in -.Pa /boot/device.hints ) . .Ss Boot Variables In general, the module .Pa snd_foo @@ -119,17 +189,18 @@ utility. Options which can be specified in .Pa /boot/loader.conf include: -.Bl -tag -width ".Va snd_emu10k1_load" -offset indent +.Bl -tag -width ".Va snd_driver_load" -offset indent .It Va snd_driver_load .Pq Dq Li NO If set to .Dq Li YES , this option loads all available drivers. -.It Va snd_emu10k1_load +.It Va snd_hda_load .Pq Dq Li NO If set to .Dq Li YES , -only the SoundBlaster 5.1 driver and dependent modules will be loaded. +only the Intel High Definition Audio bridge device driver and dependent +modules will be loaded. .It Va snd_foo_load .Pq Dq Li NO If set to @@ -155,8 +226,9 @@ This provides a base interface for relat support. Multichannel audio works both with and without .Tn VCHANs . -Most bridge device drivers are still missing multichannel matrixing support -, but in most cases this should be trivial to implement. +.Pp +Most bridge device drivers are still missing multichannel matrixing +support, but in most cases this should be trivial to implement. Use the .Va dev.pcm.%d.[play|rec].vchanformat .Xr sysctl(8) @@ -173,7 +245,7 @@ controls (bass and treble). Commonly used for ear-candy or frequency compensation due to the vast difference in hardware quality. EQ is disabled by default, but can be enabled with the -.Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +.Va hint.pcm.%d.eq tunable. .Ss VCHANs Each device can optionally support more playback and recording channels @@ -208,13 +280,13 @@ driver. The following tunables can not be changed during runtime using .Xr sysctl 8 . .Bl -tag -width indent -.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +.It Va hint.pcm.%d.eq Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer. Requires a driver reload if changed. Enabling this will make bass and treble controls appear in mixer applications. This tunable is undefined by default. Equalizing is disabled by default. -.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .vpc +.It Va hint.pcm.%d.vpc Set to 1 or 0 to explicitly enable (1) or disable (0) the .Tn VPC feature. @@ -512,6 +584,9 @@ On devices that have more than one recor there is a corresponding .Pa /dev/dsp%d.r%d device. +The +.Xr mixer 8 +utility can be used to start and stop recording from an specific device. .Ss Statistics Channel statistics are only kept while the device is open. So with situations involving overruns and underruns, consider the output @@ -586,6 +661,31 @@ For specific sound card access, please i .Pa /dev/dsp or .Pa /dev/dsp%d . +.Sh EXAMPLES +Use the sound metadriver to load all +.Nm +bridge device drivers at once +(for example if it is unclear which the correct driver to use is): +.Pp +.Dl kldload snd_driver +.Pp +Load a specific bridge device driver, in this case the Intel +High Definition Audio driver: +.Pp +.Dl kldload snd_hda +.Pp +Check the status of all detected +.Nm +devices: +.Pp +.Dl cat /dev/sndstat +.Pp +Change the default sound device, in this case to the second device. +This is handy if there are multiple +.Nm +devices available: +.Pp +.Dl sysctl hw.snd.default_unit=1 .Sh DIAGNOSTICS .Bl -diag .It pcm%d:play:%d:dsp%d.p%d: play interrupt timeout, channel dead @@ -596,12 +696,14 @@ A device node is not created properly. .El .Sh SEE ALSO .Xr snd_ad1816 4 , +.Xr snd_ai2s 4 , .Xr snd_als4000 4 , .Xr snd_atiixp 4 , .Xr snd_audiocs 4 , .Xr snd_cmi 4 , .Xr snd_cs4281 4 , .Xr snd_csa 4 , +.Xr snd_davbus 4 , .Xr snd_ds1 4 , .Xr snd_emu10k1 4 , .Xr snd_emu10kx 4 , @@ -630,6 +732,7 @@ A device node is not created properly. .Xr loader.conf 5 , .Xr dmesg 8 , .Xr kldload 8 , +.Xr mixer 8 , .Xr sysctl 8 .Rs .%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert Bristow-Johnson" Modified: projects/hid/share/man/man4/smp.4 ============================================================================== --- projects/hid/share/man/man4/smp.4 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/share/man/man4/smp.4 Tue Aug 2 00:46:25 2011 (r224586) @@ -63,10 +63,10 @@ the read-only sysctl variable .Pp .Fx allows specific CPUs on a multi-processor system to be disabled. -The sysctl variable -.Va machdep.hlt_cpus -is an integer bitmask denoting CPUs to halt, counting from 0. -Setting a bit to 1 will result in the corresponding CPU being +This can be done using the +.Va hint.lapic.X.disabled +tunable, where X is the APIC ID of a CPU. +Setting this tunable to 1 will result in the corresponding CPU being disabled. .Pp The @@ -122,12 +122,12 @@ tasks on CPUs that are closely grouped t supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms. Since using logical CPUs can cause performance penalties under certain loads, the logical CPUs can be disabled by setting the -.Va machdep.hlt_logical_cpus -sysctl to one. -Note that this operation is different from the mechanism used by the +.Va machdep.hyperthreading_allowed +tunable to zero. .Xr cpuset 1 . .Sh SEE ALSO .Xr mptable 1 , +.Xr loader 8 , .Xr sysctl 8 , .Xr condvar 9 , .Xr msleep 9 , Modified: projects/hid/share/man/man9/taskqueue.9 ============================================================================== --- projects/hid/share/man/man9/taskqueue.9 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/share/man/man9/taskqueue.9 Tue Aug 2 00:46:25 2011 (r224586) @@ -188,7 +188,8 @@ The count is cleared, and the old value returned in the reference parameter .Fa pendp , -if it is non- Dv NULL . +if it is non- +.Dv NULL . If the task is currently running, .Dv EBUSY is returned, otherwise 0. Modified: projects/hid/share/man/man9/vfs_getopt.9 ============================================================================== --- projects/hid/share/man/man9/vfs_getopt.9 Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/share/man/man9/vfs_getopt.9 Tue Aug 2 00:46:25 2011 (r224586) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2009 +.Dd July 31, 2011 .Dt VFS_GETOPT 9 .Os .Sh NAME @@ -51,7 +51,7 @@ .Fn vfs_getops "struct vfsoptlist *opts" "const char *name" "int *error" .Ft int .Fo vfs_flagopt -.Fa "struct vfsoptlist *opts" "const char *name" "u_int *flags" "u_int flag" +.Fa "struct vfsoptlist *opts" "const char *name" "uint64_t *flags" "uint64_t flag" .Fc .Ft int .Fo vfs_scanopt Modified: projects/hid/sys/amd64/amd64/machdep.c ============================================================================== --- projects/hid/sys/amd64/amd64/machdep.c Mon Aug 1 22:36:28 2011 (r224585) +++ projects/hid/sys/amd64/amd64/machdep.c Tue Aug 2 00:46:25 2011 (r224586) @@ -1309,7 +1309,7 @@ getmemsize(caddr_t kmdp, u_int64_t first { int i, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Aug 3 03:52:16 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 207F1106564A; Wed, 3 Aug 2011 03:52:16 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 069CC8FC17; Wed, 3 Aug 2011 03:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p733qFQP084797; Wed, 3 Aug 2011 03:52:15 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p733qFVm084795; Wed, 3 Aug 2011 03:52:15 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201108030352.p733qFVm084795@svn.freebsd.org> From: Mark Linimon Date: Wed, 3 Aug 2011 03:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224621 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2011 03:52:16 -0000 Author: linimon (doc,ports committer) Date: Wed Aug 3 03:52:15 2011 New Revision: 224621 URL: http://svn.freebsd.org/changeset/base/224621 Log: No need to compile pnohang for every port build; cache it. While here, try to add some more debugging. (The problem that was triggering the mount-fails was 'path too long' for certain build names; I cannot figure out why this is triggered. From a cursory reading of the mount(8) command, it should not.) Modified: projects/portbuild/scripts/portbuild Modified: projects/portbuild/scripts/portbuild ============================================================================== --- projects/portbuild/scripts/portbuild Wed Aug 3 02:02:23 2011 (r224620) +++ projects/portbuild/scripts/portbuild Wed Aug 3 03:52:15 2011 (r224621) @@ -21,6 +21,8 @@ mount_fs() else mount_nfs -o ro -3 -i ${master}:${fs} ${mntpt} fi + + return $? } copypkg() @@ -223,6 +225,7 @@ mkdir -p ${chroot}/${WRKDIRPREFIX} # pick up value from /portbuild.conf if [ ! -z "${ccache_dir}" ]; then mkdir -p ${chroot}/root/.ccache/ + # XXX MCL return value not checked if [ "${ccache_dir_nfs}" = "1" ]; then mount_nfs -o rw -T -3 ${ccache_dir} ${chroot}/root/.ccache/ else @@ -230,12 +233,12 @@ if [ ! -z "${ccache_dir}" ]; then fi fi -mount_fs ${builddir}/ports ${chroot}/a/ports ${CLIENT_NFS_MASTER} +mount_fs ${builddir}/ports ${chroot}/a/ports ${CLIENT_NFS_MASTER} || bailout ${chroot} ${clean} 255 ${pkgname} ln -sf ../a/ports ${chroot}/usr/ports -mkdir -p ${chroot}/usr/src +mkdir -p ${chroot}/usr/src || bailout ${chroot} ${clean} 255 ${pkgname} -mount_fs ${builddir}/src ${chroot}${CLIENT_SRCBASE} ${CLIENT_NFS_MASTER} +mount_fs ${builddir}/src ${chroot}${CLIENT_SRCBASE} ${CLIENT_NFS_MASTER} || bailout ${chroot} ${clean} 255 ${pkgname} # set overrides for uname buildenv.client ${chroot}${CLIENT_SRCBASE} @@ -266,8 +269,8 @@ mtree -deU -f ${chroot}/a/ports/Template for i in ${ARCHS_REQUIRING_LINPROCFS}; do if [ ${i} = ${arch} ]; then # JDK ports need linprocfs :( - mkdir -p ${chroot}/compat/linux/proc - mount -t linprocfs linprocfs ${chroot}/compat/linux/proc + mkdir -p ${chroot}/compat/linux/proc || bailout ${chroot} ${clean} 255 ${pkgname} + mount -t linprocfs linprocfs ${chroot}/compat/linux/proc || bailout ${chroot} ${clean} 255 ${pkgname} break fi done @@ -306,12 +309,19 @@ while [ $# -gt 0 ]; do done cp -p /tmp/${buildid}/scripts/buildscript ${chroot} -cp -p /tmp/${buildid}/sources/pnohang.c ${chroot} -# phase 0, compile pnohang -chroot ${chroot} /usr/bin/gcc -o /pnohang -Wall /pnohang.c 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log -if [ $? -ne 0 ]; then - error=255 +# phase 0, compile pnohang if necessary +if [ ! -f /tmp/${buildid}/sources/pnohang ]; then + cp -p /tmp/${buildid}/sources/pnohang.c ${chroot} + chroot ${chroot} /usr/bin/gcc -o /pnohang -Wall /pnohang.c 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log + if [ $? -ne 0 ]; then + error=255 + else + chown ports-${arch} ${chroot}/pnohang + cp -p ${chroot}/pnohang /tmp/${buildid}/sources/ + fi +else + cp -p /tmp/${buildid}/sources/pnohang ${chroot} fi if [ "${error}" = 0 ]; then