ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: Grigory Batalov <bga@altlinux.ru>
To: devel-kernel@altlinux.ru
Subject: [d-kernel] Invalid kernel header included in userspace
Date: Mon, 8 Dec 2003 14:46:18 +0300
Message-ID: <20031208144618.0f48b4f7.bga@altlinux.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

  Здравствуйте!

  У меня есть утилита tpctlir из пакета tpctl, включающая
и выключающая инфракрасный порт на некоторых ноутбуках IBM
ThinkPad (600-х серий). При сборке в хэшере выходит на неё
ругань:

<skip>
cc -pipe -Wall -O2 -march=i586 -mcpu=i686 -Wcast-align -Wstrict-prototypes -o tpctlir tpctlir.c
In file included from /usr/include/linux/config.h:4,
                 from /usr/include/asm/system.h:4,
                 from tpctlir.c:1:
/usr/include/linux/autoconf.h:1:2: #error Invalid kernel header included in userspace
<skip>

  Хотя в обычной системе она собирается. Я проверил, конечным
в цепочке является файл /var/run/kernel/autoconf.h из пакета
kernel-headers-common-1.1.3-alt1. В дереве хэшера этого файла
нет, и указание в Buildreq соответствующего пакета не помогает.
Наверное, он специально блокируется.

  Исходник tpctlir прилагаю. Похоже, весь сыр-бор разгорелся
из-за функций cli() и sti(). Прошу совета, как, всё-таки,
собрать эту программу в пакет.

-- 
Григорий Баталов,
группа техподдержки
ОАО "Ковдорский ГОК"

[-- Attachment #2: tpctlir.c --]
[-- Type: text/plain, Size: 1276 bytes --]

//#include <asm/system.h>
#include <sys/io.h>
#include <stdio.h>

/*
 * enable/disable IR on IBM ThinkPads with
 * Programmable Option Select (e.g., the 760 and 765)
 */

int main(int argc, char **argv)
{
    int val94, mask;
    int enable;

    if (argc != 2) {
        printf("usage: tpctlir (0|1)\n");
        return 1;
    } else if (strcmp(argv[1], "0") == 0) {
        enable = 0;
    } else if (strcmp(argv[1], "1") == 0) {
        enable = 1;
    } else {
        printf("usage: tpctlir (0|1)\n");
        return 1;
    }

    if ( iopl(3) ) {
        fprintf(stderr, "Permission denied - are you root?\n");
        return 2;
    }

    cli();

    val94 = inb(0x94);              /* POS mask register */
    outb(0xfE, 0x94);               /* mask bit (0) for IR; changes enabled */
    outb(0xfE, 0x47);               /* pause */

    mask = inb(0x0102);             /* POS enable register */
    mask &= 0xFE;                   /* mask bit (0) for IR enable/disable*/
    mask |= enable;                 /* 1 to enable, 0 to disable */
    outb(mask, 0x102);
    outb(mask, 0x47);               /* pause */

    outb(val94, 0x94);              /* restore POS mask to prevent changing */
    outb(val94, 0x47);              /* pause */

    sti();

    return 0;
}

             reply	other threads:[~2003-12-08 11:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-08 11:46 Grigory Batalov [this message]
2003-12-08 12:08 ` Sergey Vlasov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031208144618.0f48b4f7.bga@altlinux.ru \
    --to=bga@altlinux.ru \
    --cc=devel-kernel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git