From owner-freebsd-questions@FreeBSD.ORG Wed Nov 24 18:57:03 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA83C1065670 for ; Wed, 24 Nov 2010 18:57:03 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id A030D8FC16 for ; Wed, 24 Nov 2010 18:57:03 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email2.allantgroup.com (8.14.4/8.14.4) with ESMTP id oAOIv2Un027785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 12:57:02 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id oAOIv2iX092593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 12:57:02 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.4/Submit) id oAOIv2Nf092592; Wed, 24 Nov 2010 12:57:02 -0600 (CST) (envelope-from dan) Date: Wed, 24 Nov 2010 12:57:02 -0600 From: Dan Nelson To: David DEMELIER Message-ID: <20101124185702.GE58734@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 8.1-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.96.4 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (email2.allantgroup.com [199.67.51.78]); Wed, 24 Nov 2010 12:57:02 -0600 (CST) X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78 Cc: FreeBSD Questions Subject: Re: trying to sysctl(3) a char value X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 18:57:03 -0000 In the last episode (Nov 24), David DEMELIER said: > Since I cannot adjust the brightness on my HP Probook because it sucks > I'm writing a small script that can be use instead. I need to sysctl > the following sysctl variables : > > hw.acpi.video.lcd0.brightness > hw.acpi.video.lcd0.levels > > the -brightness one is easy since it's an integer, but the levels is > possibly a char : > > markand@Melon ~ $ sysctl hw.acpi.video.lcd0.brightness > hw.acpi.video.lcd0.brightness: 90 > markand@Melon ~ $ sysctl hw.acpi.video.lcd0.levels > hw.acpi.video.lcd0.levels: 100 50 0 5 10 15 20 25 30 33 36 40 43 46 50 55 60 65 70 75 80 83 86 90 93 96 100 Looking at the source, that sysctl definition is CTLTYPE_OPAQUE with a display format of "I", which means that it's just an array of integers. Print each one in a loop. You can also take a look at /usr/src/sbin/sysctl/sysctl.c to see how it printed the numbers. -- Dan Nelson dnelson@allantgroup.com