Package: printconf
Severity: normal
Tags: patch
Hi
If I attach parallel printers without reloading the kernel modules
printconf does not have a way of knowing about these new printers,
since /proc/sys/dev/parport/parport*/autoprobe is not updated.
The attached patch reloads the kernel modules. Not sure whether
there should be additional sanity checks, but I guess it should be
ok as an additional commandline option. Would you want to include
something like the patch below to address this issue?
Cheers
Steffen
--- /usr/bin/printconf 2008-10-06 03:59:55.000000000 +0200
+++ printconf 2008-12-05 09:50:24.000000000 +0100
@@ -44,10 +44,13 @@
action='store_true', help="don't configure any printers")
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
help="include more detail about what's happening")
+parser.add_option('-m', '--parallel-module', dest='parallel_module',
action='store_true',
+ help="reload the parallel kernel modules to detect newly
connected printers")
options, args = parser.parse_args()
dryrun = options.dryrun
verbose = options.verbose
+parallel_module = options.parallel_module
if os.geteuid() and not dryrun:
print >> sys.stderr, "Please run printconf as root or specify the
--dry-run option."
@@ -109,6 +112,12 @@
for q in existing.queues:
queues[q['name']] = True
+# Make sure we reload the kernel module so that the files under
/proc/sys/dev/parport get updated
+if parallel_module and not dryrun:
+ print 'Reload the parallel kernel modules to detect newly connected
printers'
+ os.system('/sbin/rmmod ppdev lp parport_pc parport 2>/dev/null')
+ os.system('/sbin/modprobe -a parport parport_pc ppdev lp 2>/dev/null')
+
for (device, detectdata, devdesc, detectdesc) in conns:
# Skip everything we don't have autodetection data for
if not detectdata: