From mario_00 at libero.it  Sat Apr 10 16:26:23 2004
From: mario_00 at libero.it (mario_00@libero.it)
Date: Thu Apr 15 09:55:01 2004
Subject: [Linux-parport] Colorado Backup 8Gb parallel port
Message-ID: <HVYINZ$FF719E8F5E322AD2F95A192AEFCBF890@libero.it>

Hi,
I'm a new user of linux Mandrake v.10 o.s. (installed following normal installation instructions);
I don't have any particular devices installed; 
I need to install a Colorado Backup 8Gb (PARALLEL PORT), could anyone describe me a detailed installation (i mean the list of commands in order to make the device works)?

Thank for support.
My best regards 
MARIO


From erich at uruk.org  Sat Apr 10 14:08:48 2004
From: erich at uruk.org (Erich Boleyn)
Date: Thu Apr 15 09:55:01 2004
Subject: [Linux-parport] 
	Control PS/2 keyboard input via Parallel port in Linux?
Message-ID: <E1BCOmW-0008UR-1r@uruk.org>


Greetings,

I need to control a computer's PS/2 keyboard input (well, I need to
control a KVM switch via a PS/2 keyboard connector, in my case, but
it's supposed to be the same) via a computer running Linux, i.e.
behave as a PS/2 keyboard.  A parallel port would be one of the
easiest ways to go about this.

Before starting on it, I figured it was worth asking if someone
has code and hardware description (probably some 74xx-like parts
and a few resistors on a breadboard to handle the bidirectional
signalling would do it) laying around rather than going through
the pain of debugging a PS/2 wire signalling protocol.  I checked
on the web and found at least one reference to doing it on Linux,
done by "vojtechpavlik", but the web link
"http://www.suse.cz/development" was stale.

Also, could someone recommend a brand of USB -> Parallel hardware
that's known to have a supported chipset?  The references I found
aren't clear on this.

Thanks all.

--
    Erich Stefan Boleyn     <erich@uruk.org>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"

From nate at uniwest.com  Mon Apr 19 11:52:11 2004
From: nate at uniwest.com (Nate Jenkins)
Date: Mon Apr 19 18:52:47 2004
Subject: [Linux-parport] ppdev and kernel panic
Message-ID: <01a901c42637$0beb18f0$9101a8c0@Nate>

Hello,

I have seen a problem which I do not know if it has been fixed or not.

I am using a relatively old/ancient kernel.  Kernel 2.4.2-2 which is Red Hat
7.1.  This kernel has built into it 'parport.o' and 'parport_pc.o'
statically.

OK, I have had a program working which will automatically switch between
'ppdev.o' and 'lp.o'.  That is to say, my code will "insmod ppdev" or
"insmod lp".  When switching the code will respectively "rmmod lp" or "rmmod
ppdev".  Everything is successful in the ioctl functions and with using this
modules to communicate via parallel port.

The problem is when I shutdown the computer.  If I never use 'ppdev' in a
session, it will shutdown fine.  If I load 'ppdev' at anytime in the
session, then the pc will fail to shutdown correctly.

I can tell that no modules are inserted into kernel via "lsmod" before I
"halt" the computer.

Does anyone know what maybe happening here?  Or can I clarify anything I
have failed to make clear?

It seems that it might be related to claiming the port.  If I do not "claim"
the port I do not have this issue.  However, I cannot do my communication
without claiming it.  So I am claiming it.  I am also releasing it at the
end.  Although the ioctl returns zero, I think it isn't really releasing it,
thus causing the kernel panic.

If I can compile the ppdev module with new source and it works, then, that
would be a valid solution for me.  I would really like to know what is going
on though.

Nate




From nate at uniwest.com  Mon Apr 19 12:37:11 2004
From: nate at uniwest.com (Nate Jenkins)
Date: Mon Apr 19 19:37:37 2004
Subject: [Linux-parport] ppdev and kernel panic
References: <01a901c42637$0beb18f0$9101a8c0@Nate>
Message-ID: <000801c4263d$54bb5440$9101a8c0@Nate>


I noticed something else that maybe of interest.  It may not have to do with
the claim as much as with what is on the status pins.

I tried to load 'ppdev' with and without the parallel port cable and it
looks like it may have something to do with it.  With the cable on, it will
not shut down correctly, but without, it seems to shutdown fine.

Last week, it was the opposite, with the cable it was fine but without it
would kernel panic after "halt".

What does this indicate?  Something to do with the ~BUSY or ACK bit state
maybe when releasing?

Nate


----- Original Message ----- 
From: "Nate Jenkins" <nate@uniwest.com>
To: "Parport" <linux-parport@lists.infradead.org>
Sent: Monday, April 19, 2004 10:52 AM
Subject: [Linux-parport] ppdev and kernel panic


> Hello,
>
> I have seen a problem which I do not know if it has been fixed or not.
>
> I am using a relatively old/ancient kernel.  Kernel 2.4.2-2 which is Red
Hat
> 7.1.  This kernel has built into it 'parport.o' and 'parport_pc.o'
> statically.
>
> OK, I have had a program working which will automatically switch between
> 'ppdev.o' and 'lp.o'.  That is to say, my code will "insmod ppdev" or
> "insmod lp".  When switching the code will respectively "rmmod lp" or
"rmmod
> ppdev".  Everything is successful in the ioctl functions and with using
this
> modules to communicate via parallel port.
>
> The problem is when I shutdown the computer.  If I never use 'ppdev' in a
> session, it will shutdown fine.  If I load 'ppdev' at anytime in the
> session, then the pc will fail to shutdown correctly.
>
> I can tell that no modules are inserted into kernel via "lsmod" before I
> "halt" the computer.
>
> Does anyone know what maybe happening here?  Or can I clarify anything I
> have failed to make clear?
>
> It seems that it might be related to claiming the port.  If I do not
"claim"
> the port I do not have this issue.  However, I cannot do my communication
> without claiming it.  So I am claiming it.  I am also releasing it at the
> end.  Although the ioctl returns zero, I think it isn't really releasing
it,
> thus causing the kernel panic.
>
> If I can compile the ppdev module with new source and it works, then, that
> would be a valid solution for me.  I would really like to know what is
going
> on though.
>
> Nate
>
>
>
>
> _______________________________________________
> Linux-parport mailing list
> Linux-parport@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-parport
>


From hannal at us.ibm.com  Tue Apr 20 14:44:19 2004
From: hannal at us.ibm.com (Hanna Linder)
Date: Tue Apr 20 22:32:55 2004
Subject: [Linux-parport] 
	[PATCH 2.6.5 RFT] add class support to drivers/block/paride/pt.c 
Message-ID: <7660000.1082493859@w-hlinder.beaverton.ibm.com>



Hi,

This patch adds class support to pt.c which "the high-level driver for parallel port ATAPI tape
drives based on chips supported by the paride module." Which I dont have in order to test.

I have verified it compiles but can not test it. If someone who has the hardware could
I would appreciate it.

Hanna Linder
IBM Linux Technology Center
------------
diff -Nrup -Xdontdiff linux-2.6.5/drivers/block/paride/pt.c linux-2.6.5p/drivers/block/paride/pt.c
--- linux-2.6.5/drivers/block/paride/pt.c	2004-04-03 19:36:52.000000000 -0800
+++ linux-2.6.5p/drivers/block/paride/pt.c	2004-04-16 16:09:52.000000000 -0700
@@ -145,6 +145,7 @@ static int (*drives[4])[6] = {&drive0, &
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/mtio.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -260,6 +261,9 @@ static struct file_operations pt_fops = 
 	.release = pt_release,
 };
 
+/* sysfs class support */
+static struct class_simple *pt_class;
+
 static inline int status_reg(struct pi_adapter *pi)
 {
 	return pi_read_regr(pi, 1, 6);
@@ -959,33 +963,62 @@ static ssize_t pt_write(struct file *fil
 
 static int __init pt_init(void)
 {
-	int unit;
+	int unit, err = 0;
 
-	if (disable)
-		return -1;
+	if (disable) {
+		err = -1;
+		goto out;
+	}
 
-	if (pt_detect())
-		return -1;
+	if (pt_detect()) {
+		err = -1;
+		goto out;
+	}
 
 	if (register_chrdev(major, name, &pt_fops)) {
 		printk("pt_init: unable to get major number %d\n", major);
 		for (unit = 0; unit < PT_UNITS; unit++)
 			if (pt[unit].present)
 				pi_release(pt[unit].pi);
-		return -1;
+		err = -1;
+		goto out;
+	}
+	pt_class = class_simple_create(THIS_MODULE, "pt");
+	if (IS_ERR(pt_class)) {
+		err = PTR_ERR(pt_class);
+		goto out_chrdev;
 	}
 
 	devfs_mk_dir("pt");
 	for (unit = 0; unit < PT_UNITS; unit++)
 		if (pt[unit].present) {
-			devfs_mk_cdev(MKDEV(major, unit),
+			class_simple_device_add(pt_class, MKDEV(major, unit), 
+					NULL, "pt%d", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit),
 				      S_IFCHR | S_IRUSR | S_IWUSR,
 				      "pt/%d", unit);
-			devfs_mk_cdev(MKDEV(major, unit + 128),
+			if (err) {
+				class_simple_device_remove(MKDEV(major, unit));
+				goto out_class;
+			}
+			class_simple_device_add(pt_class, MKDEV(major, unit + 128),
+					NULL, "pt%dn", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit + 128),
 				      S_IFCHR | S_IRUSR | S_IWUSR,
 				      "pt/%dn", unit);
+			if (err) {
+				class_simple_device_remove(MKDEV(major, unit + 128));
+				goto out_class;
+			}
 		}
-	return 0;
+	goto out;
+
+out_class:
+	class_simple_destroy(pt_class);
+out_chrdev:
+	unregister_chrdev(major, "pt");
+out:
+	return err;
 }
 
 static void __exit pt_exit(void)
@@ -993,9 +1026,12 @@ static void __exit pt_exit(void)
 	int unit;
 	for (unit = 0; unit < PT_UNITS; unit++)
 		if (pt[unit].present) {
+			class_simple_device_remove(MKDEV(major, unit));
 			devfs_remove("pt/%d", unit);
+			class_simple_device_remove(MKDEV(major, unit + 128));
 			devfs_remove("pt/%dn", unit);
 		}
+	class_simple_destroy(pt_class);
 	devfs_remove("pt");
 	unregister_chrdev(major, name);
 	for (unit = 0; unit < PT_UNITS; unit++)



From callmd at cogeco.ca  Wed Apr 21 15:42:14 2004
From: callmd at cogeco.ca (callMD)
Date: Thu Apr 22 10:20:44 2004
Subject: [Linux-parport] 
	external Paraller Port CD Bruner (MicoSolution Backpack)
In-Reply-To: <E1BGFSX-0007LG-W4@pentafluge.infradead.org>
References: <E1BGFSX-0007LG-W4@pentafluge.infradead.org>
Message-ID: <1082572934.2417.0.camel@aditya>

I have a external Parallel port port CD Burner, it had drivers (paride/pg) available in Mandrake 9.1 and i could use the cd burner with xcdroast. 

This was missing in Mandrake 9.2, i initially thought this was a quirk, now I find this does not exist in Mandrake 10.0 as well.

What happened? Any help will be much appreciated.

Thanx

Siva


From hannal at us.ibm.com  Wed Apr 21 16:57:50 2004
From: hannal at us.ibm.com (Hanna Linder)
Date: Thu Apr 22 10:20:45 2004
Subject: [Linux-parport] 
	[PATCH 2.6.6-rc1] RFT add class support to drivers/block/paride/pg.c
Message-ID: <41480000.1082588270@w-hlinder.beaverton.ibm.com>


This patch adds class support to pg.c, the parallel port generic ATAPI device driver.

I have verified it compiles but do not have the hardware. If someone does and
could test that would be helpful.

Thanks.

Hanna Linder
IBM Linux Technology Center
----
diff -Nrup linux-2.6.6-rc1/drivers/block/paride/pg.c linux-2.6.6-rc1p/drivers/block/paride/pg.c
--- linux-2.6.6-rc1/drivers/block/paride/pg.c	2004-04-14 18:35:37.000000000 -0700
+++ linux-2.6.6-rc1p/drivers/block/paride/pg.c	2004-04-21 14:50:32.000000000 -0700
@@ -161,6 +161,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV,
 #include <linux/slab.h>
 #include <linux/mtio.h>
 #include <linux/pg.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -240,6 +241,8 @@ static int pg_identify(struct pg *dev, i
 
 static char pg_scratch[512];	/* scratch block buffer */
 
+static struct class_simple *pg_class;
+
 /* kernel glue structures */
 
 static struct file_operations pg_fops = {
@@ -658,15 +661,19 @@ static ssize_t pg_read(struct file *filp
 
 static int __init pg_init(void)
 {
-	int unit;
+	int unit, err = 0;
 
-	if (disable)
-		return -1;
+	if (disable){
+		err = -1;
+		goto out;
+	}
 
 	pg_init_units();
 
-	if (pg_detect())
-		return -1;
+	if (pg_detect()) {
+		err = -1;
+		goto out;
+	}
 
 	if (register_chrdev(major, name, &pg_fops)) {
 		printk("pg_init: unable to get major number %d\n", major);
@@ -675,18 +682,37 @@ static int __init pg_init(void)
 			if (dev->present)
 				pi_release(dev->pi);
 		}
-		return -1;
+		err = -1;
+		goto out;
+	}
+	pg_class = class_simple_create(THIS_MODULE, "pg");
+	if (IS_ERR(pg_class)) {
+		err = PTR_ERR(pg_class);
+		goto out_chrdev;
 	}
 	devfs_mk_dir("pg");
 	for (unit = 0; unit < PG_UNITS; unit++) {
 		struct pg *dev = &devices[unit];
 		if (dev->present) {
-			devfs_mk_cdev(MKDEV(major, unit),
+			class_simple_device_add(pg_class, MKDEV(major, unit), 
+					NULL, "pg%u", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit),
 				      S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u",
 				      unit);
+			if (err) 
+				goto out_class;
 		}
 	}
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	class_simple_device_remove(MKDEV(major, unit));
+	class_simple_destroy(pg_class);
+out_chrdev:
+	unregister_chrdev(major, "pg");
+out:
+	return err;
 }
 
 static void __exit pg_exit(void)
@@ -695,10 +721,12 @@ static void __exit pg_exit(void)
 
 	for (unit = 0; unit < PG_UNITS; unit++) {
 		struct pg *dev = &devices[unit];
-		if (dev->present)
+		if (dev->present) {
+			class_simple_device_remove(MKDEV(major, unit));
 			devfs_remove("pg/%u", unit);
+		}
 	}
-
+	class_simple_destroy(pg_class);
 	devfs_remove("pg");
 	unregister_chrdev(major, name);
 

From christian at visual-page.de  Sat Apr 24 01:44:12 2004
From: christian at visual-page.de (Christian Gmeiner)
Date: Fri Apr 23 23:40:51 2004
Subject: [Linux-parport] Problems with parport
Message-ID: <003601c42984$800ca230$0600a8c0@blackbox>

Hi,

can somebody explain me the changes from 2.4 to 2.6 in parport source? I have here an GLCD, which
is connected to the parport. On the 2.4 Kernel it runs superb, but on the 2.6(.5) there is a lot of nonsens on the lcd. Also it seems to be very very slow in contrast to the 2.4er.

I know that you need more infos, but what kind of infos?

It would be nice, if you send me an answer.

Greets, Christian Gmeiner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.infradead.org/pipermail/linux-parport/attachments/20040424/37ecfe62/attachment.htm
From flohack at sbox.tugraz.at  Wed Apr 28 14:34:15 2004
From: flohack at sbox.tugraz.at (Florian Hackenberger)
Date: Wed Apr 28 12:34:15 2004
Subject: [Linux-parport] How to Set Pins permanently
Message-ID: <408FB2D7.5000603@sbox.tugraz.at>

Hello!

Can anybody tell me how to set pins on the parallel port permanently.
When using:
parport_write_data(port, 7);
Pins 2,3,4 are on for  about 45seconds. But after this period, they are
off again.

Regards,
    Florian

-- 
Florian Hackenberger
student @
University of Technology
Graz, Austria
flohack@sbox.tugraz.at



From hannal at us.ibm.com  Tue Apr 27 16:52:28 2004
From: hannal at us.ibm.com (Hanna Linder)
Date: Thu Apr 29 16:31:57 2004
Subject: [Linux-parport] 
	[PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c
Message-ID: <12810000.1083106348@dyn318071bld.beaverton.ibm.com>


Here is a patch to add class support to drivers/char/ppdev.c. I have verified
it compiles and works on my system. 

Please test or consider for inclusion.

Thanks

Hanna Linder
IBM Linux Technology Center
--------
diff -Nrup linux-2.6.6-rc1/drivers/char/ppdev.c linux-2.6.6-rc1p/drivers/char/ppdev.c
--- linux-2.6.6-rc1/drivers/char/ppdev.c	2004-04-14 18:36:01.000000000 -0700
+++ linux-2.6.6-rc1p/drivers/char/ppdev.c	2004-04-27 14:56:56.000000000 -0700
@@ -84,6 +84,8 @@ struct pp_struct {
 	long default_inactivity;
 };
 
+static struct class_simple *ppdev_class;
+
 /* pp_struct.flags bitfields */
 #define PP_CLAIMED    (1<<0)
 #define PP_EXCL       (1<<1)
@@ -752,29 +754,53 @@ static struct file_operations pp_fops = 
 
 static int __init ppdev_init (void)
 {
-	int i;
+	int i, err = 0;
 
 	if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
 		printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
 			PP_MAJOR);
-		return -EIO;
+		err = -EIO;
+		goto out;
+	}
+	ppdev_class = class_simple_create(THIS_MODULE, CHRDEV);
+	if (IS_ERR(ppdev_class)) {
+		err = PTR_ERR(ppdev_class);
+		goto out_chrdev;
 	}
 	devfs_mk_dir("parports");
 	for (i = 0; i < PARPORT_MAX; i++) {
-		devfs_mk_cdev(MKDEV(PP_MAJOR, i),
+		class_simple_device_add(ppdev_class, MKDEV(PP_MAJOR, i), 
+				NULL, "parport%d", i);
+		err = devfs_mk_cdev(MKDEV(PP_MAJOR, i),
 				S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i);
+		if (err) 
+			goto out_class;
 	}
 
 	printk (KERN_INFO PP_VERSION "\n");
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	for (i = 0; i < PARPORT_MAX; i++) 
+		class_simple_device_remove(MKDEV(PP_MAJOR, i));
+	class_simple_destroy(ppdev_class);
+out_chrdev:
+	unregister_chrdev(PP_MAJOR, CHRDEV);
+out:
+	return err;
+
 }
 
 static void __exit ppdev_cleanup (void)
 {
 	int i;
 	/* Clean up all parport stuff */
-	for (i = 0; i < PARPORT_MAX; i++)
+	for (i = 0; i < PARPORT_MAX; i++) {
+		class_simple_device_remove(MKDEV(PP_MAJOR, i));
 		devfs_remove("parports/%d", i);
+	}
+	class_simple_destroy(ppdev_class);
 	devfs_remove("parports");
 	unregister_chrdev (PP_MAJOR, CHRDEV);
 }


From greg at kroah.com  Tue Apr 27 18:29:15 2004
From: greg at kroah.com (Greg KH)
Date: Thu Apr 29 16:31:58 2004
Subject: [Linux-parport] 
	Re: [PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c
In-Reply-To: <12810000.1083106348@dyn318071bld.beaverton.ibm.com>
References: <12810000.1083106348@dyn318071bld.beaverton.ibm.com>
Message-ID: <20040428002915.GI10548@kroah.com>

On Tue, Apr 27, 2004 at 03:52:28PM -0700, Hanna Linder wrote:
> 
> Here is a patch to add class support to drivers/char/ppdev.c. I have verified
> it compiles and works on my system. 
> 
> Please test or consider for inclusion.

Sorry, but I already have a pending patch for this :(

greg k-h

From f.hackenberger at chello.at  Wed Apr 28 14:32:30 2004
From: f.hackenberger at chello.at (Florian Hackenberger)
Date: Thu Apr 29 16:31:58 2004
Subject: [Linux-parport] How to Set Pins permanently
Message-ID: <408FB26E.2080607@chello.at>

Hello!

Can anybody tell me how to set pins on the parallel port permanently. 
When using:
parport_write_data(port, 7);
Pins 2,3,4 are on for  about 45seconds. But after this period, they are 
off again.

Regards,
    Florian

-- 
Florian Hackenberger
student @
University of Technology
Graz, Austria
flohack@sbox.tugraz.at


From hannal at us.ibm.com  Wed Apr 28 16:09:26 2004
From: hannal at us.ibm.com (Hanna Linder)
Date: Thu Apr 29 16:32:00 2004
Subject: [Linux-parport] 
	[PATCH 2.6.6-rc3] add class support to drivers/char/tipar.c
Message-ID: <53520000.1083190166@dyn318071bld.beaverton.ibm.com>


This patch adds class support to the Texas Instruments graphing calculators
with a parallel link cable.

I have verified it compiles. If someone has the hardware please verify it works.

Thanks.

Hanna Linder
IBM Linux Technology Center
-----------
diff -Nrup -X dontdiff linux-2.6.6-rc3/drivers/char/tipar.c linux-2.6.6-rc3p/drivers/char/tipar.c
--- linux-2.6.6-rc3/drivers/char/tipar.c	2004-04-27 18:36:20.000000000 -0700
+++ linux-2.6.6-rc3p/drivers/char/tipar.c	2004-04-28 13:48:10.000000000 -0700
@@ -58,6 +58,7 @@
 #include <asm/bitops.h>
 #include <linux/devfs_fs_kernel.h>	/* DevFs support */
 #include <linux/parport.h>	/* Our code depend on parport */
+#include <linux/device.h>
 
 /*
  * TI definitions
@@ -92,6 +93,8 @@ static int timeout = TIMAXTIME;	/* timeo
 static unsigned int tp_count;	/* tipar count */
 static unsigned long opened;	/* opened devices */
 
+static struct class_simple *tipar_class;
+
 /* --- macros for parport access -------------------------------------- */
 
 #define r_dtr(x)        (parport_read_data(table[(x)].dev->port))
@@ -424,18 +427,26 @@ tipar_setup(char *str)
 static int
 tipar_register(int nr, struct parport *port)
 {
+	int err = 0;
+
 	/* Register our module into parport */
 	table[nr].dev = parport_register_device(port, "tipar",
 						NULL, NULL, NULL, 0,
 						(void *) &table[nr]);
 
-	if (table[nr].dev == NULL)
-		return 1;
+	if (table[nr].dev == NULL) {
+		err = 1;
+		goto out;
+	}
 
+	class_simple_device_add(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
+			NULL, "par%d", nr);
 	/* Use devfs, tree: /dev/ticables/par/[0..2] */
-	devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
+	err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
 			S_IFCHR | S_IRUGO | S_IWUGO,
 			"ticables/par/%d", nr);
+	if (err)
+		goto out_class;
 
 	/* Display informations */
 	printk(KERN_INFO "tipar%d: using %s (%s).\n", nr, port->name,
@@ -447,7 +458,14 @@ tipar_register(int nr, struct parport *p
 	else
 		printk("tipar%d: link cable not found.\n", nr);
 
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	class_simple_device_remove(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr));
+	class_simple_destroy(tipar_class);
+out:
+	return err;
 }
 
 static void
@@ -477,23 +495,38 @@ static struct parport_driver tipar_drive
 int __init
 tipar_init_module(void)
 {
+	int err = 0;
+
 	printk("tipar: parallel link cable driver, version %s\n",
 	       DRIVER_VERSION);
 
 	if (register_chrdev(TIPAR_MAJOR, "tipar", &tipar_fops)) {
 		printk("tipar: unable to get major %d\n", TIPAR_MAJOR);
-		return -EIO;
+		err = -EIO;
+		goto out;
 	}
 
 	/* Use devfs with tree: /dev/ticables/par/[0..2] */
 	devfs_mk_dir("ticables/par");
 
+	tipar_class = class_simple_create(THIS_MODULE, "ticables");
+	if (IS_ERR(tipar_class)) {
+		err = PTR_ERR(tipar_class);
+		goto out_chrdev;
+	}
 	if (parport_register_driver(&tipar_driver)) {
 		printk("tipar: unable to register with parport\n");
-		return -EIO;
+		err = -EIO;
+		goto out;
 	}
 
-	return 0;
+	err = 0;
+	goto out;
+
+out_chrdev:
+	unregister_chrdev(TIPAR_MAJOR, "tipar");
+out:
+	return err;	
 }
 
 void __exit
@@ -510,8 +543,10 @@ tipar_cleanup_module(void)
 		if (table[i].dev == NULL)
 			continue;
 		parport_unregister_device(table[i].dev);
+		class_simple_device_remove(MKDEV(TIPAR_MAJOR, i));
 		devfs_remove("ticables/par/%d", i);
 	}
+	class_simple_destroy(tipar_class);
 	devfs_remove("ticables/par");
 
 	printk("tipar: module unloaded !\n");


