From owner-freebsd-questions@FreeBSD.ORG Wed Nov 24 19:01:30 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 545901065697 for ; Wed, 24 Nov 2010 19:01:30 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 03EFF8FC08 for ; Wed, 24 Nov 2010 19:01:29 +0000 (UTC) Received: by vws9 with SMTP id 9so62847vws.13 for ; Wed, 24 Nov 2010 11:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=v0bngJIROr3ys9k/Ymp+S8h5p1L4npLjpgFC+q1hZAs=; b=W2xTqXGs06UhpYT3ovfyB8FyHD2IduShveTYa7C3kI6jz/bAH2Qq2Sjufst0LfPsI5 XLt3cz8IonsproiIguiOak8Eo0kBy3DsoQwtbycWGqxru/e466uP+du23kgl8sgrjWv0 SAKhcZqySIRfOEefkhmRGAPq3VkoRhK5uHisw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=x3Rlzw6upP4SveUAK4wwkKEdOUHwwDzsu1T1mv9uicewMfe/Jd6wpXbyfrDazM6+KX hk0pE8SGy0RyNN12F0ErnM71JQjFPWGlzPz2Kcn4zvumZeF3Q2VGtOTLDhe+X9+PnqSk 5fsvXo3GPjtyiJXttIAL+QhSVO9IPgwlsbhiY= MIME-Version: 1.0 Received: by 10.204.120.71 with SMTP id c7mr3152180bkr.4.1290625288006; Wed, 24 Nov 2010 11:01:28 -0800 (PST) Received: by 10.204.127.20 with HTTP; Wed, 24 Nov 2010 11:01:27 -0800 (PST) In-Reply-To: <20101124185702.GE58734@dan.emsphone.com> References: <20101124185702.GE58734@dan.emsphone.com> Date: Wed, 24 Nov 2010 20:01:27 +0100 Message-ID: From: David DEMELIER To: Dan Nelson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 19:01:30 -0000 2010/11/24 Dan Nelson : > 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 5= 5 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. =C2=A0You can also take a look at > /usr/src/sbin/sysctl/sysctl.c to see how it printed the numbers. > > -- > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dan Nelson > =C2=A0 =C2=A0 =C2=A0 =C2=A0dnelson@allantgroup.com > Thank you, it works ! --=20 Demelier David