View previous topic :: View next topic |
Author |
Message |
motaboy Developer
Joined: 15 Dec 2003 Posts: 1483
|
Posted: Tue Apr 13, 2004 6:32 pm Post subject: [Hotplug-Script] ISAPNP Hotplug Support!!! |
|
|
Hi to all.
I was very bored for the fact that hotplug wasn't able to manage my isapnp devices.
You'll say: "But who has these OLD devices?"
This is not true: every PC has at least 10 of this devices and if you do a modular kernel with for example: 8250 (serialports), parport_pc, ns558 (game port) etc... this modules won't be autoloaded because there isn't an hotplug script to manage them.
Another Fact is that if you use udev you can't put them in "modules.autoload" because they are loaded BEFORE hotplug and so the devices in /dev aren't created by udev, This is very annoying!
SO I've writed an "hotplug.rc" and "hotplug.agent" scripts.
I don't know if I've do something wrong due to my low level of documentation on how isapnp works.
Description
isapnp.rc:
It checks for the presence of sysfs (2.6 kernel) and use his data.
If sysfs isn't supported (<= 2.4 kernels) then "procfs" is used. The vendor and function hex value are retrieved from "/proc/bus/pnp/devices" or "/proc/bus/isapnp/devices" and sent to the isapnp.agent. I CAN'T TEST THIS THING BECAUSE I DON'T HAVE A 2.4 WORKING KERNEL (I'll do it in the next days). IF SOMEONE CAN POST THE CONTENTS OF HIS /proc/bus/isapnp/devices WILL BE VERY HELPFUL.
isapnp.agent:
This agent act like the usb and pci agent. It get and add command and a variabile ISAPNP_ID.
It has a function that do the bash parse of modules.isapnpmap to retrieve the needed module name.
Installation
Get the tarbzipped file here:
http://members.xoom.virgilio.it/motaboy/hotplug-isapnp-0.2.1.tar.bz2
0.1) To use it, you have to enable the isapnp proc support in your kernel.
In make menuconfig o xconfig you need to activate this:
Code: |
Device Drivers ->
[*] Plug and Play support
[ ] PnP Debug Messages
--- Protocols
[*] ISA Plug and Play support
[*] Plug and Play BIOS support (EXPERIMENTAL)
[*] Plug and Play BIOS /proc interface
Bus options (PCI, PCMCIA, EISA, MCA, ISA) ->
[*] ISA support
|
Or in the .config :
Code: |
#
# Plug and Play support
#
CONFIG_PNP=y
# CONFIG_PNP_DEBUG is not set
#
# Protocols
#
CONFIG_ISAPNP=y
CONFIG_PNPBIOS=y
CONFIG_PNPBIOS_PROC_FS=y
|
HELP: It's a lot of time that I don't use a 2.4 kernel so I don't know what's the options for 2.4 kernels and if it exist.
Can someone that know it to write here what is this option? So I can test it with 2.4 kernels too.
0.2) You need the latest module-init-tools:
Code: |
sys-apps/module-init-tools-3.0
|
1)Untar it and you'll find a dir called "hotplug-isapnp-0.2.1".
2) Copy isapnp.rc and isapnp.agent in /etc/hotplug, you must be root.
Code: |
cp isapnp.rc /etc/hotplug
cp isapnp.agent /etc/hotplug
|
3) Make them executables :
Code: |
cd /etc/hotplug
chmod +x isapnp.rc
chmod +x isapnp.agent
|
I hope this will be useful and let me know if you've tried it please!
Bye! _________________ ...
Last edited by motaboy on Wed Apr 21, 2004 12:41 pm; edited 3 times in total |
|
Back to top |
|
|
motaboy Developer
Joined: 15 Dec 2003 Posts: 1483
|
Posted: Tue Apr 20, 2004 2:20 pm Post subject: |
|
|
Hi again,
I've noticed that there are some modules using Isa devices (or at least I think) that aren't loaded by my hotplug scripts because they aren't "hotplug compliant".
They don't export any isapnp id via the MODULE_DEVICE_TABLE macro and so the file /lib/modules/`uname -r`/modules.isapnpmap hasn't any information on which module to load.
I've found 3 of this modules:
psmouse (The PSmouse module)
pcspkr (PC Speaker)
rtc (real time clock)
I don't know it this is the right way to do the things but I think that it's a GOOD way and this works on various systems.
Of course you need the isapnp hotplug scripts that you'll find in the previous post.
The patch is agains kernel 2.6.5
Like any kernel patch you can apply it by doing:
Code: |
cd /usr/src/linux-2.X.X-blablabla
|
Code: |
patch -Np1 < FILEDELLAPATCH
|
This is the patch for the 3 modules:
Code: |
--- linux-2.6.5/drivers/input/mouse/psmouse-base.c 2004-04-04 18:08:37.000000000 +0200
+++ linux-2.6.5-prova01/drivers/input/mouse/psmouse-base.c 2004-04-19 10:37:56.000000000 +0200
@@ -18,6 +18,7 @@
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/init.h>
+#include <linux/pnp.h>
#include "psmouse.h"
#include "synaptics.h"
#include "logips2pp.h"
@@ -739,5 +740,13 @@
serio_unregister_device(&psmouse_dev);
}
+static const struct pnp_device_id pnp_dev_table[] = {
+ /* PS/2 port for PS/2-style mice */
+ { "PNP0f13", 0 },
+ { "", 0 }
+};
+
+MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
+
module_init(psmouse_init);
module_exit(psmouse_exit);
--- linux-2.6.5/drivers/input/misc/pcspkr.c 2003-12-18 03:58:57.000000000 +0100
+++ linux-2.6.5-prova01/drivers/input/misc/pcspkr.c 2004-04-19 11:04:06.000000000 +0200
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/input.h>
#include <asm/io.h>
+#include <linux/pnp.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("PC Speaker beeper driver");
@@ -90,5 +91,13 @@
input_unregister_device(&pcspkr_dev);
}
+static const struct pnp_device_id pnp_dev_table[] = {
+ /* AT-style speaker sound */
+ { "PNP0800", 0 },
+ { "", 0 }
+};
+
+MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
+
module_init(pcspkr_init);
module_exit(pcspkr_exit);
--- linux-2.6.5/drivers/char/rtc.c 2004-04-04 18:08:34.000000000 +0200
+++ linux-2.6.5-prova01/drivers/char/rtc.c 2004-04-19 10:59:35.000000000 +0200
@@ -77,6 +77,7 @@
#include <linux/sysctl.h>
#include <linux/wait.h>
#include <linux/bcd.h>
+#include <linux/pnp.h>
#include <asm/current.h>
#include <asm/uaccess.h>
@@ -1346,6 +1347,14 @@
}
#endif
+static const struct pnp_device_id pnp_dev_table[] = {
+ /* AT real-time clock */
+ { "PNP0b00", 0 },
+ { "", 0 }
+};
+
+MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
+
MODULE_AUTHOR("Paul Gortmaker");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(RTC_MINOR);
|
If there're some problem appling it you can doin it by hand.
You have only to add the include file
Code: |
#include <linux/pnp.h>
|
and the table (where you want).
For example for psmouse the table and the export macro are:
Code: |
static const struct pnp_device_id pnp_dev_table[] = {
/* PS/2 port for PS/2-style mice */
{ "PNP0f13", 0 },
{ "", 0 }
};
MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
|
Please let me know if it works, or if you have any problem I'll be very happy to help you.
Bye! _________________ ... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|