Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

View: New views
6 Messages — Rating Filter:   Alert me  

Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Jan Niehusmann :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Package: openct
Version: 0.6.10-1
Severity: normal
Tags: patch

The cm4000 driver fails to load because the initialization routine calls
ifd_sevice_set_parameters which in turn tries to call
dev->ops->set_params(). This function is currently only defined for
serial and usb devices, but not for pcmcia devices.

The proper fix may be implementing the set_params function for cm4000,
but the following patch does work for now (and in fact only reverts a
recent regression in openct):

Only in openct-0.6.10-orig/src/ifd: .ifd-cm4000.c.swp
diff -ur openct-0.6.10-orig/src/ifd/ifd-cm4000.c openct-0.6.10/src/ifd/ifd-cm4000.c
--- openct-0.6.10-orig/src/ifd/ifd-cm4000.c 2006-09-12 22:55:14.000000000 +0200
+++ openct-0.6.10/src/ifd/ifd-cm4000.c 2006-11-21 11:13:25.000000000 +0100
@@ -42,11 +42,16 @@
 
  params = dev->settings;
  params.usb.interface = 0;
+ /* ifd_sevice_set_parameters does not work for cm4000, as dev->ops->set_params
+ * is not defined.
+
  if (ifd_device_set_parameters(dev, ¶ms) < 0) {
  ct_error("cm4000: setting parameters failed", device_name);
  ifd_device_close(dev);
  return -1;
  }
+
+ */
 
  return 0;
 }



-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'oldstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18.2-vs2.0.2.2-rc3vserver-g9be2442a
Locale: LANG=C, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)

Versions of packages openct depends on:
ii  adduser                      3.99        Add and remove users and groups
ii  dpkg                         1.13.24     package maintenance system for Deb
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries
ii  libltdl3                     1.5.22-4    A system independent dlopen wrappe
ii  libopenct1                   0.6.10-1    middleware framework for smart car
ii  libusb-0.1-4                 2:0.1.12-2  userspace USB programming library

Versions of packages openct recommends:
ii  udev                          0.100-2.3  /dev/ and hotplug management daemo

-- no debconf information


--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Eric Dorland :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

* Jan Niehusmann (jan@...) wrote:

> Package: openct
> Version: 0.6.10-1
> Severity: normal
> Tags: patch
>
> The cm4000 driver fails to load because the initialization routine calls
> ifd_sevice_set_parameters which in turn tries to call
> dev->ops->set_params(). This function is currently only defined for
> serial and usb devices, but not for pcmcia devices.
>
> The proper fix may be implementing the set_params function for cm4000,
> but the following patch does work for now (and in fact only reverts a
> recent regression in openct):
Has this been discussed upstream at all?
 

> Only in openct-0.6.10-orig/src/ifd: .ifd-cm4000.c.swp
> diff -ur openct-0.6.10-orig/src/ifd/ifd-cm4000.c openct-0.6.10/src/ifd/ifd-cm4000.c
> --- openct-0.6.10-orig/src/ifd/ifd-cm4000.c 2006-09-12 22:55:14.000000000 +0200
> +++ openct-0.6.10/src/ifd/ifd-cm4000.c 2006-11-21 11:13:25.000000000 +0100
> @@ -42,11 +42,16 @@
>  
>   params = dev->settings;
>   params.usb.interface = 0;
> + /* ifd_sevice_set_parameters does not work for cm4000, as dev->ops->set_params
> + * is not defined.
> +
>   if (ifd_device_set_parameters(dev, ¶ms) < 0) {
>   ct_error("cm4000: setting parameters failed", device_name);
>   ifd_device_close(dev);
>   return -1;
>   }
> +
> + */
>  
>   return 0;
>  }
>
--
Eric Dorland <eric@...>
ICQ: #61138586, Jabber: hooty@...
1024D/16D970C6 097C 4861 9934 27A0 8E1C  2B0A 61E9 8ECF 16D9 70C6



signature.asc (196 bytes) Download Attachment

Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Jan Niehusmann-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 21, 2006 at 10:31:13PM -0500, Eric Dorland wrote:
> Has this been discussed upstream at all?

No, not yet. I just fixed the driver because I needed access to my
cm4000, and I wanted to share the fix. As I don't know trac (the
bugtracking system used upstream) and I don't have much spare time at
the moment, I just sent the patch to the debian BTS.

If you like, feel free to contact upstream, as I don't know when I'll
have time to do so.

Sorry for doing only half of the work.

Jan



--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Andreas Jellinghaus-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

please try attached patch instead.

Thanks, Andreas

diff -udrNPp --exclude=.svn openct.orig/src/ifd/pcmcia-block.c openct/src/ifd/pcmcia-block.c
--- openct.orig/src/ifd/pcmcia-block.c 2006-04-21 08:38:04.000000000 +0200
+++ openct/src/ifd/pcmcia-block.c 2006-11-22 10:30:05.000000000 +0100
@@ -81,6 +81,17 @@ ifd_pcmcia_block_recv(ifd_device_t * dev
 }
 
 /*
+ * Set pcmcia params
+ */
+static int ifd_pcmcia_block_set_params(ifd_device_t * dev,
+                          const ifd_device_params_t * params)
+{
+        /* nothing to do so far */
+        dev->settings = *params;
+        return 0;
+}
+
+/*
  * Close the device
  */
 static void ifd_pcmcia_block_close(ifd_device_t * dev)
@@ -107,6 +118,7 @@ ifd_device_t *ifd_open_pcmcia_block(cons
 
  ifd_pcmcia_block_ops.send = ifd_pcmcia_block_send;
  ifd_pcmcia_block_ops.recv = ifd_pcmcia_block_recv;
+ ifd_pcmcia_block_ops.set_params = ifd_pcmcia_block_set_params;
  ifd_pcmcia_block_ops.close = ifd_pcmcia_block_close;
 
  dev = ifd_device_new(name, &ifd_pcmcia_block_ops, sizeof(*dev));
diff -udrNPp --exclude=.svn openct.orig/src/ifd/pcmcia.c openct/src/ifd/pcmcia.c
--- openct.orig/src/ifd/pcmcia.c 2006-04-21 08:38:04.000000000 +0200
+++ openct/src/ifd/pcmcia.c 2006-11-22 10:29:55.000000000 +0100
@@ -89,6 +89,17 @@ static int ifd_pcmcia_recv(ifd_device_t
 }
 
 /*
+ * Set pcmcia params
+ */
+static int ifd_pcmcia_set_params(ifd_device_t * dev,
+  const ifd_device_params_t * params)
+{
+ /* nothing to do so far */
+        dev->settings = *params;
+ return 0;
+}
+
+/*
  * Close the device
  */
 static void ifd_pcmcia_close(ifd_device_t * dev)
@@ -115,6 +126,7 @@ ifd_device_t *ifd_open_pcmcia(const char
 
  ifd_pcmcia_ops.send = ifd_pcmcia_send;
  ifd_pcmcia_ops.recv = ifd_pcmcia_recv;
+ ifd_pcmcia_ops.set_params = ifd_pcmcia_set_params;
  ifd_pcmcia_ops.close = ifd_pcmcia_close;
 
  dev = ifd_device_new(name, &ifd_pcmcia_ops, sizeof(*dev));

Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Jan Niehusmann-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 22, 2006 at 10:34:41AM +0100, Andreas Jellinghaus wrote:
> please try attached patch instead.

The patch should do the same as mine, just putting the NOP one layer
deeper. And as expected, it works fine. Thanks for cleaning up the quick
band-aid fix I posted.

Jan


--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#399682: openct: cm4000 driver fails with "cm4000: setting parameters failed"

by Andreas Jellinghaus-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Eric Dorland wrote:
> Has this been discussed upstream at all?

the fix is correct, but mine is nicer I think.

when /proc/bus/usb got duplicated into /dev/bus/usb
udev also spawned openct twice, and two ifdhanlders
could try to talk to the same device, which didn't work.

a glogal usb_claim_interface code did also not work fine
with combo devices such as keyboard+smart card reader
combo devices.

so we moved the usb_claim_interface code to the usb set_param
function and made sure all ifd handler set the parameter.
but when I changed that, I didn't think of the cm40x0 devices,
and forgot to test them, thus I broke them. one way to fix it
is to undo this change, a bit nice might be to implement set_params
and get_params with dummy functions that can be extended later.

my proposed patch already implements set_params, will commit
it for 0.6.12 with set_params, too.

Regards, Andreas


--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...