Re: O2micro smartcard reader driver.
On 2/19/07, Éric Piel <[EMAIL PROTECTED]> wrote: > 02/17/2007 04:55 AM, Markus Rechberger wrote/a écrit: > > Hi Eric, > > > > I committed your code to linuxtv.org to review and modify it there. > > http://linuxtv.org/hg/~mrechberger/chipcardreader > > > > one thing I noticed is the error handling in ozscr_probe. > > > > I'll continue the rest during the next few days, I'd like to see it as > > soon as possible in the upstream kernel before some kernel api changes > > again which affects your current driver. > > Hi Markus, > > Thank you very much for finding new bugs ;-) Actually, right now I've > just moved and don't have internet at home which is kind of slowing down > development... Anyway, I'll check if I have some more fixes on my > computer than on my website. Also, it would be good to double check some > lines which I've commented XXX. In particular, IIRC there were some > suspicious sleep saying it was sleeping a microsecond and sleeping one > millisecond! as user noone cares if it's 1 ns or 1 ms, since that part seems to work as it is just leave it. > > I'm also a bit concerned about the userspace "driver" for pscd which > comes with the original driver once the patch will be part of the > default kernel. Maybe this userspace part could become part of the > pscdlite distribution. > I couldn't find the sources of the userspace library, the link on musclecard.com is dead (and there's no backup on archive.org) > Wrt the module having always a usecount value of 1, it was worrying me > too at the begining until I noticed it decreased back to 0 once the card > is "ejected" (pccardctl eject 1). Although a bit surprising, I don't > think it's a bug, is it? this is where the pcmcia/pccard framework bug becomes relevant. The usecount is no bug, but the lockup (which got explained in the other mail) is one > > See you, > Eric > > -- Markus Rechberger Operating System Research Center AMD Saxony LLC & Co. KG - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
02/17/2007 04:55 AM, Markus Rechberger wrote/a écrit: Hi Eric, I committed your code to linuxtv.org to review and modify it there. http://linuxtv.org/hg/~mrechberger/chipcardreader one thing I noticed is the error handling in ozscr_probe. I'll continue the rest during the next few days, I'd like to see it as soon as possible in the upstream kernel before some kernel api changes again which affects your current driver. Hi Markus, Thank you very much for finding new bugs ;-) Actually, right now I've just moved and don't have internet at home which is kind of slowing down development... Anyway, I'll check if I have some more fixes on my computer than on my website. Also, it would be good to double check some lines which I've commented XXX. In particular, IIRC there were some suspicious sleep saying it was sleeping a microsecond and sleeping one millisecond! I'm also a bit concerned about the userspace "driver" for pscd which comes with the original driver once the patch will be part of the default kernel. Maybe this userspace part could become part of the pscdlite distribution. Wrt the module having always a usecount value of 1, it was worrying me too at the begining until I noticed it decreased back to 0 once the card is "ejected" (pccardctl eject 1). Although a bit surprising, I don't think it's a bug, is it? See you, Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
02/17/2007 04:55 AM, Markus Rechberger wrote/a écrit: Hi Eric, I committed your code to linuxtv.org to review and modify it there. http://linuxtv.org/hg/~mrechberger/chipcardreader one thing I noticed is the error handling in ozscr_probe. I'll continue the rest during the next few days, I'd like to see it as soon as possible in the upstream kernel before some kernel api changes again which affects your current driver. Hi Markus, Thank you very much for finding new bugs ;-) Actually, right now I've just moved and don't have internet at home which is kind of slowing down development... Anyway, I'll check if I have some more fixes on my computer than on my website. Also, it would be good to double check some lines which I've commented XXX. In particular, IIRC there were some suspicious sleep saying it was sleeping a microsecond and sleeping one millisecond! I'm also a bit concerned about the userspace driver for pscd which comes with the original driver once the patch will be part of the default kernel. Maybe this userspace part could become part of the pscdlite distribution. Wrt the module having always a usecount value of 1, it was worrying me too at the begining until I noticed it decreased back to 0 once the card is ejected (pccardctl eject 1). Although a bit surprising, I don't think it's a bug, is it? See you, Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
On 2/19/07, Éric Piel [EMAIL PROTECTED] wrote: 02/17/2007 04:55 AM, Markus Rechberger wrote/a écrit: Hi Eric, I committed your code to linuxtv.org to review and modify it there. http://linuxtv.org/hg/~mrechberger/chipcardreader one thing I noticed is the error handling in ozscr_probe. I'll continue the rest during the next few days, I'd like to see it as soon as possible in the upstream kernel before some kernel api changes again which affects your current driver. Hi Markus, Thank you very much for finding new bugs ;-) Actually, right now I've just moved and don't have internet at home which is kind of slowing down development... Anyway, I'll check if I have some more fixes on my computer than on my website. Also, it would be good to double check some lines which I've commented XXX. In particular, IIRC there were some suspicious sleep saying it was sleeping a microsecond and sleeping one millisecond! as user noone cares if it's 1 ns or 1 ms, since that part seems to work as it is just leave it. I'm also a bit concerned about the userspace driver for pscd which comes with the original driver once the patch will be part of the default kernel. Maybe this userspace part could become part of the pscdlite distribution. I couldn't find the sources of the userspace library, the link on musclecard.com is dead (and there's no backup on archive.org) Wrt the module having always a usecount value of 1, it was worrying me too at the begining until I noticed it decreased back to 0 once the card is ejected (pccardctl eject 1). Although a bit surprising, I don't think it's a bug, is it? this is where the pcmcia/pccard framework bug becomes relevant. The usecount is no bug, but the lockup (which got explained in the other mail) is one See you, Eric -- Markus Rechberger Operating System Research Center AMD Saxony LLC Co. KG - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
Hi Eric, I committed your code to linuxtv.org to review and modify it there. http://linuxtv.org/hg/~mrechberger/chipcardreader one thing I noticed is the error handling in ozscr_probe. I'll continue the rest during the next few days, I'd like to see it as soon as possible in the upstream kernel before some kernel api changes again which affects your current driver. Markus On 2/17/07, Markus Rechberger <[EMAIL PROTECTED]> wrote: Hi, so finally I'm also looking at that driver, http://pieleric.free.fr/o2scr/ the driver compiles fine, though it doesn't seem to work (unless I'm doing something wrong here) dmesg shows up following entries: pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 OZSCRLX O2Micro SmartCardBus Reader (for kernel >= 2.6.17) The module for any reason has a usecount value of 1 ozscrlx21548 1 devicenode /dev/ozscrlx isn't opened anywhere either. I'll do some further investigations uppon it, I'd also like to see it directly in the kernel. It would be handy to use for encrypted filesystems. Markus On 12/12/06, Eric Piel <[EMAIL PROTECTED]> wrote: > 28.11.2006 12:49, Oliver Neukum wrote/a écrit: > >> Latest version I've published is there: > >> http://pieleric.free.fr/o2scr/ > > > > case OZSCR_OPEN: /* Request ICC */ > > dprintk("OZSCR_OPEN\n"); > > ATRLength = ATR_SIZE; > > pRdrExt->IOBase = (PSCR_REGISTERS *) dev->io_base; //XXX > necessary? > > pRdrExt->membase = dev->am_base; //XXX necessary? > > > > pRdrExt->m_SCard.AvailableProtocol = 0; > > pRdrExt->m_SCard.RqstProtocol = 0; > > dprintk("membase:%p\n", pRdrExt->membase); > > dprintk("ioport:0x%03x\n", (unsigned)pRdrExt->IOBase); > > > > ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ); > > apdu.LengthOut = ATRLength; > > > > #ifdef PCMCIA_DEBUG > > printk(KERN_DEBUG "Open finished, ATR buffer = "); > > for( ATRLength = 0; ATRLength < apdu.LengthOut; ATRLength++ ) > > printk(" [%02X] ", ATRBuffer[ATRLength] ); > > printk("\n"); > > #endif > > > > memcpy( apdu.DataOut, ATRBuffer, ATRLength ); > > ret = copy_to_user((struct ozscr_apdu *)arg, , > sizeof(struct ozscr_apdu)); > > break; > > > > 1. This needs locking against concurrent ioctls > > 2. The interpretation of copy_to_user()'s return code is incorrect > > > > Hi Oliver, > > Thanks a lot for reading my code, I didn't even hope that someone would! > I've corrected the copy_to_user (and copy_from_user) code. However I > don't know how to do locking for the concurrent ioctls. Indeed, I don't > think there is anything preventing two programs to call the driver at > the same time. Unfortunately, I've got no idea how to do the locking and > surprisingly couldn't find any ioctl code in the kernel doing locking. > Maybe I've just not looked at the right place, could you give a me some > hint how to do locking for ioctl's ? > > See you, > Eric > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- Markus Rechberger -- Markus Rechberger --- ozscrlx.c.1 2006-12-12 22:28:24.0 +0100 +++ ozscrlx.c 2007-02-17 01:00:46.0 +0100 @@ -596,14 +596,14 @@ dev = kzalloc(sizeof(struct ozscr_dev_t), GFP_KERNEL); if (dev == NULL) { dprintk("allocate ozscr_dev_t fail\n"); - goto ErrHandle; + goto ErrHandle1; } /* Allocate space for private device-specific data */ dev->o2scr_reader = kzalloc(sizeof(READER_EXTENSION *), GFP_KERNEL); if (dev->o2scr_reader == NULL) { dprintk("allocate READER_EXTENSION fail\n"); - goto ErrHandle; + goto ErrHandle2; } p_dev->priv = dev; @@ -628,7 +628,7 @@ ret = ozscr_config(p_dev); if (ret) - goto ErrHandle; + goto ErrHandle3; // it's just so redundant... we could merge those fields together dev->o2scr_reader->IOBase = (PSCR_REGISTERS *) dev->io_base; @@ -644,11 +644,11 @@ dprintk("function complete\n"); return 0; - ErrHandle: - /* Free the allocated memory space */ - if (dev) - kfree(dev->o2scr_reader); + ErrHandle3: + kfree(dev->o2scr_reader); + ErrHandle2: kfree(dev); + ErrHandle1: return ret; }
Re: O2micro smartcard reader driver.
Hi, so finally I'm also looking at that driver, http://pieleric.free.fr/o2scr/ the driver compiles fine, though it doesn't seem to work (unless I'm doing something wrong here) dmesg shows up following entries: pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 OZSCRLX O2Micro SmartCardBus Reader (for kernel >= 2.6.17) The module for any reason has a usecount value of 1 ozscrlx21548 1 devicenode /dev/ozscrlx isn't opened anywhere either. I'll do some further investigations uppon it, I'd also like to see it directly in the kernel. It would be handy to use for encrypted filesystems. Markus On 12/12/06, Eric Piel <[EMAIL PROTECTED]> wrote: 28.11.2006 12:49, Oliver Neukum wrote/a écrit: >> Latest version I've published is there: >> http://pieleric.free.fr/o2scr/ > > case OZSCR_OPEN: /* Request ICC */ > dprintk("OZSCR_OPEN\n"); > ATRLength = ATR_SIZE; > pRdrExt->IOBase = (PSCR_REGISTERS *) dev->io_base; //XXX necessary? > pRdrExt->membase = dev->am_base; //XXX necessary? > > pRdrExt->m_SCard.AvailableProtocol = 0; > pRdrExt->m_SCard.RqstProtocol = 0; > dprintk("membase:%p\n", pRdrExt->membase); > dprintk("ioport:0x%03x\n", (unsigned)pRdrExt->IOBase); > > ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ); > apdu.LengthOut = ATRLength; > > #ifdef PCMCIA_DEBUG > printk(KERN_DEBUG "Open finished, ATR buffer = "); > for( ATRLength = 0; ATRLength < apdu.LengthOut; ATRLength++ ) > printk(" [%02X] ", ATRBuffer[ATRLength] ); > printk("\n"); > #endif > > memcpy( apdu.DataOut, ATRBuffer, ATRLength ); > ret = copy_to_user((struct ozscr_apdu *)arg, , sizeof(struct ozscr_apdu)); > break; > > 1. This needs locking against concurrent ioctls > 2. The interpretation of copy_to_user()'s return code is incorrect > Hi Oliver, Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? See you, Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Markus Rechberger - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
Hi, so finally I'm also looking at that driver, http://pieleric.free.fr/o2scr/ the driver compiles fine, though it doesn't seem to work (unless I'm doing something wrong here) dmesg shows up following entries: pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 OZSCRLX O2Micro SmartCardBus Reader (for kernel = 2.6.17) The module for any reason has a usecount value of 1 ozscrlx21548 1 devicenode /dev/ozscrlx isn't opened anywhere either. I'll do some further investigations uppon it, I'd also like to see it directly in the kernel. It would be handy to use for encrypted filesystems. Markus On 12/12/06, Eric Piel [EMAIL PROTECTED] wrote: 28.11.2006 12:49, Oliver Neukum wrote/a écrit: Latest version I've published is there: http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk(OZSCR_OPEN\n); ATRLength = ATR_SIZE; pRdrExt-IOBase = (PSCR_REGISTERS *) dev-io_base; //XXX necessary? pRdrExt-membase = dev-am_base; //XXX necessary? pRdrExt-m_SCard.AvailableProtocol = 0; pRdrExt-m_SCard.RqstProtocol = 0; dprintk(membase:%p\n, pRdrExt-membase); dprintk(ioport:0x%03x\n, (unsigned)pRdrExt-IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ATRLength ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG Open finished, ATR buffer = ); for( ATRLength = 0; ATRLength apdu.LengthOut; ATRLength++ ) printk( [%02X] , ATRBuffer[ATRLength] ); printk(\n); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, apdu, sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect Hi Oliver, Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? See you, Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Markus Rechberger - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
Hi Eric, I committed your code to linuxtv.org to review and modify it there. http://linuxtv.org/hg/~mrechberger/chipcardreader one thing I noticed is the error handling in ozscr_probe. I'll continue the rest during the next few days, I'd like to see it as soon as possible in the upstream kernel before some kernel api changes again which affects your current driver. Markus On 2/17/07, Markus Rechberger [EMAIL PROTECTED] wrote: Hi, so finally I'm also looking at that driver, http://pieleric.free.fr/o2scr/ the driver compiles fine, though it doesn't seem to work (unless I'm doing something wrong here) dmesg shows up following entries: pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 pccard: card ejected from slot 1 PCMCIA: socket c160c364: *** DANGER *** unable to remove socket power pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 OZSCRLX O2Micro SmartCardBus Reader (for kernel = 2.6.17) The module for any reason has a usecount value of 1 ozscrlx21548 1 devicenode /dev/ozscrlx isn't opened anywhere either. I'll do some further investigations uppon it, I'd also like to see it directly in the kernel. It would be handy to use for encrypted filesystems. Markus On 12/12/06, Eric Piel [EMAIL PROTECTED] wrote: 28.11.2006 12:49, Oliver Neukum wrote/a écrit: Latest version I've published is there: http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk(OZSCR_OPEN\n); ATRLength = ATR_SIZE; pRdrExt-IOBase = (PSCR_REGISTERS *) dev-io_base; //XXX necessary? pRdrExt-membase = dev-am_base; //XXX necessary? pRdrExt-m_SCard.AvailableProtocol = 0; pRdrExt-m_SCard.RqstProtocol = 0; dprintk(membase:%p\n, pRdrExt-membase); dprintk(ioport:0x%03x\n, (unsigned)pRdrExt-IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ATRLength ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG Open finished, ATR buffer = ); for( ATRLength = 0; ATRLength apdu.LengthOut; ATRLength++ ) printk( [%02X] , ATRBuffer[ATRLength] ); printk(\n); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, apdu, sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect Hi Oliver, Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? See you, Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Markus Rechberger -- Markus Rechberger --- ozscrlx.c.1 2006-12-12 22:28:24.0 +0100 +++ ozscrlx.c 2007-02-17 01:00:46.0 +0100 @@ -596,14 +596,14 @@ dev = kzalloc(sizeof(struct ozscr_dev_t), GFP_KERNEL); if (dev == NULL) { dprintk(allocate ozscr_dev_t fail\n); - goto ErrHandle; + goto ErrHandle1; } /* Allocate space for private device-specific data */ dev-o2scr_reader = kzalloc(sizeof(READER_EXTENSION *), GFP_KERNEL); if (dev-o2scr_reader == NULL) { dprintk(allocate READER_EXTENSION fail\n); - goto ErrHandle; + goto ErrHandle2; } p_dev-priv = dev; @@ -628,7 +628,7 @@ ret = ozscr_config(p_dev); if (ret) - goto ErrHandle; + goto ErrHandle3; // it's just so redundant... we could merge those fields together dev-o2scr_reader-IOBase = (PSCR_REGISTERS *) dev-io_base; @@ -644,11 +644,11 @@ dprintk(function complete\n); return 0; - ErrHandle: - /* Free the allocated memory space */ - if (dev) - kfree(dev-o2scr_reader); + ErrHandle3: + kfree(dev-o2scr_reader); + ErrHandle2: kfree(dev); + ErrHandle1: return ret; }
Re: O2micro smartcard reader driver.
Am Dienstag, 12. Dezember 2006 22:28 schrieb Eric Piel: Hi > Thanks a lot for reading my code, I didn't even hope that someone would! > I've corrected the copy_to_user (and copy_from_user) code. However I > don't know how to do locking for the concurrent ioctls. Indeed, I don't > think there is anything preventing two programs to call the driver at > the same time. Unfortunately, I've got no idea how to do the locking and > surprisingly couldn't find any ioctl code in the kernel doing locking. > Maybe I've just not looked at the right place, could you give a me some > hint how to do locking for ioctl's ? I take it back. Reading your code again, it seems to me that it'll never sleep. In this case you are protected by BKL. If not, you need to use mutexes, just like eg. in drivers/usb/class/usblp.c HTH Oliver - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
28.11.2006 12:49, Oliver Neukum wrote/a écrit: Latest version I've published is there: http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk("OZSCR_OPEN\n"); ATRLength = ATR_SIZE; pRdrExt->IOBase = (PSCR_REGISTERS *) dev->io_base; //XXX necessary? pRdrExt->membase = dev->am_base; //XXX necessary? pRdrExt->m_SCard.AvailableProtocol = 0; pRdrExt->m_SCard.RqstProtocol = 0; dprintk("membase:%p\n", pRdrExt->membase); dprintk("ioport:0x%03x\n", (unsigned)pRdrExt->IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG "Open finished, ATR buffer = "); for( ATRLength = 0; ATRLength < apdu.LengthOut; ATRLength++ ) printk(" [%02X] ", ATRBuffer[ATRLength] ); printk("\n"); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, , sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect Hi Oliver, Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? See you, Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
28.11.2006 12:49, Oliver Neukum wrote/a écrit: Latest version I've published is there: http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk(OZSCR_OPEN\n); ATRLength = ATR_SIZE; pRdrExt-IOBase = (PSCR_REGISTERS *) dev-io_base; //XXX necessary? pRdrExt-membase = dev-am_base; //XXX necessary? pRdrExt-m_SCard.AvailableProtocol = 0; pRdrExt-m_SCard.RqstProtocol = 0; dprintk(membase:%p\n, pRdrExt-membase); dprintk(ioport:0x%03x\n, (unsigned)pRdrExt-IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ATRLength ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG Open finished, ATR buffer = ); for( ATRLength = 0; ATRLength apdu.LengthOut; ATRLength++ ) printk( [%02X] , ATRBuffer[ATRLength] ); printk(\n); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, apdu, sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect Hi Oliver, Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? See you, Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
Am Dienstag, 12. Dezember 2006 22:28 schrieb Eric Piel: Hi Thanks a lot for reading my code, I didn't even hope that someone would! I've corrected the copy_to_user (and copy_from_user) code. However I don't know how to do locking for the concurrent ioctls. Indeed, I don't think there is anything preventing two programs to call the driver at the same time. Unfortunately, I've got no idea how to do the locking and surprisingly couldn't find any ioctl code in the kernel doing locking. Maybe I've just not looked at the right place, could you give a me some hint how to do locking for ioctl's ? I take it back. Reading your code again, it seems to me that it'll never sleep. In this case you are protected by BKL. If not, you need to use mutexes, just like eg. in drivers/usb/class/usblp.c HTH Oliver - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
On Tue, 28 Nov 2006 13:19:26 +0100 Andreas Jellinghaus <[EMAIL PROTECTED]> wrote: > maybe post once more, and make clear whether you are looking for: Yep it's about a smartcard reader. This reader need a kernel module to be acceded by pcscd. > > also o2micro might also create pcmcia card readers for either. > maybe let us know what kind of device you exactly have and how > it is connected (if build in... lspci / lsusb would see pci or > usb devices, pcmcia devices are found by the kernel I think). [EMAIL PROTECTED]:~$ lspcmcia - Socket 0 Bridge:[yenta_cardbus] (bus ID: :02:06.0) Configuration: state: on ready: unknown --none-- --none-- Socket 1 Bridge:[yenta_cardbus] (bus ID: :02:06.1) Configuration: state: on ready: unknown Voltage: 5.0V Vcc: 5.0V Vpp: 5.0V --none-- --none-- Socket 1 Device 0: [-- no driver --] (bus ID: 1.0) Configuration: state: on Product Name: O2Micro SmartCardBus Reader V1.0 Identification: manf_id: 0x card_id: 0x0001 prod_id(1): "O2Micro" (0x97299583) prod_id(2): "SmartCardBus Reader" (0xb8501ba9) prod_id(3): "V1.0" (0xe611e659) prod_id(4): --- (---) Socket 2 Bridge:[yenta_cardbus] (bus ID: :02:06.3) Configuration: state: on ready: unknown Voltage: 5.0V Vcc: 5.0V Vpp: 5.0V --none-- --none-- Socket 2 Device 0: [-- no driver --] (bus ID: 2.0) Configuration: state: on Product Name: O2Micro SmartCardBus Reader V1.0 Identification: manf_id: 0x card_id: 0x0001 prod_id(1): "O2Micro" (0x97299583) prod_id(2): "SmartCardBus Reader" (0xb8501ba9) prod_id(3): "V1.0" (0xe611e659) prod_id(4): --- (---) 02:06.0 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller 02:06.1 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller 02:06.2 System peripheral: O2 Micro, Inc. OZ711Mx 4-in-1 MemoryCardBus Accelerator 02:06.3 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
maybe post once more, and make clear whether you are looking for: - smart card reader support. (smart card as in "digital signature card".) o2micro creates such readers, they are usualy usb devices, conform to the ccid standard and work fine (e.g. pcsc-lite plus ccid driver or openct). - smart media card / multi media card reader support (those small memory cards used by mobile phones, cameras and so on). o2micro creates those too, they are also build in by some vendors, but I'm not sure about their situation. also o2micro might also create pcmcia card readers for either. maybe let us know what kind of device you exactly have and how it is connected (if build in... lspci / lsusb would see pci or usb devices, pcmcia devices are found by the kernel I think). Regards, Andreas - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
> Latest version I've published is there: > http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk("OZSCR_OPEN\n"); ATRLength = ATR_SIZE; pRdrExt->IOBase = (PSCR_REGISTERS *) dev->io_base; //XXX necessary? pRdrExt->membase = dev->am_base; //XXX necessary? pRdrExt->m_SCard.AvailableProtocol = 0; pRdrExt->m_SCard.RqstProtocol = 0; dprintk("membase:%p\n", pRdrExt->membase); dprintk("ioport:0x%03x\n", (unsigned)pRdrExt->IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG "Open finished, ATR buffer = "); for( ATRLength = 0; ATRLength < apdu.LengthOut; ATRLength++ ) printk(" [%02X] ", ATRBuffer[ATRLength] ); printk("\n"); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, , sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect ret = copy_from_user(, (struct ozscr_apdu *)arg, sizeof(struct ozscr_apdu)); You need to check ret, or you might write shit to the device pRdrExt->IOBase = (PSCR_REGISTERS *) dev->io_base; pRdrExt->membase = dev->am_base; pRdrExt->m_SCard.RqstProtocol = apdu.DataIn[6]; dprintk("membase:%p\n", pRdrExt->membase); dprintk("ioport:0x%03x\n", (unsigned)pRdrExt->IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ); HTH Oliver - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
11/27/2006 06:28 PM, Laurent Bigonville wrote/a écrit: Hi, I found a thread (about one month old) about an OZ711Mx (O2micro mmc card reader) driver, but unfortunately it uses some closed-source code.[1] :( But I found no thread about the kernel driver for the O2micro PCMCIA smartcard reader. So I would like to know if there is any chance that this driver may be included in the mainline kernel. The source are LGPL'ed and available via the musclecard website[2]. And I found a patch to make it compile with kernel > 2.6.13 on the ubuntu support site[3]. AFAIK the module work, the only issue I have is a small hang when inserting a card in the reader. If some one could have a look at this. Hi, Actually, this has been discussed on the MUSCLE mailing list (as implied in the ubuntu bug report): I've upgraded the driver to be compiled on 2.6.17. It works fine (even better actually) with 2.6.18 and 2.6.19. Latest version I've published is there: http://pieleric.free.fr/o2scr/ Since then, I've cleaned up the code a bit, but no bug fix. I'll try to update the version when I'm back home today ;-) Actually, I've never submitted the driver to the LKML mainly due to lack of test. I don't have any usable smartcard to check that everything works. If you could confirm it works, or tell me where it fails, it would be great! c u, Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
11/27/2006 06:28 PM, Laurent Bigonville wrote/a écrit: Hi, I found a thread (about one month old) about an OZ711Mx (O2micro mmc card reader) driver, but unfortunately it uses some closed-source code.[1] :( But I found no thread about the kernel driver for the O2micro PCMCIA smartcard reader. So I would like to know if there is any chance that this driver may be included in the mainline kernel. The source are LGPL'ed and available via the musclecard website[2]. And I found a patch to make it compile with kernel 2.6.13 on the ubuntu support site[3]. AFAIK the module work, the only issue I have is a small hang when inserting a card in the reader. If some one could have a look at this. Hi, Actually, this has been discussed on the MUSCLE mailing list (as implied in the ubuntu bug report): I've upgraded the driver to be compiled on 2.6.17. It works fine (even better actually) with 2.6.18 and 2.6.19. Latest version I've published is there: http://pieleric.free.fr/o2scr/ Since then, I've cleaned up the code a bit, but no bug fix. I'll try to update the version when I'm back home today ;-) Actually, I've never submitted the driver to the LKML mainly due to lack of test. I don't have any usable smartcard to check that everything works. If you could confirm it works, or tell me where it fails, it would be great! c u, Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
Latest version I've published is there: http://pieleric.free.fr/o2scr/ case OZSCR_OPEN: /* Request ICC */ dprintk(OZSCR_OPEN\n); ATRLength = ATR_SIZE; pRdrExt-IOBase = (PSCR_REGISTERS *) dev-io_base; //XXX necessary? pRdrExt-membase = dev-am_base; //XXX necessary? pRdrExt-m_SCard.AvailableProtocol = 0; pRdrExt-m_SCard.RqstProtocol = 0; dprintk(membase:%p\n, pRdrExt-membase); dprintk(ioport:0x%03x\n, (unsigned)pRdrExt-IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ATRLength ); apdu.LengthOut = ATRLength; #ifdef PCMCIA_DEBUG printk(KERN_DEBUG Open finished, ATR buffer = ); for( ATRLength = 0; ATRLength apdu.LengthOut; ATRLength++ ) printk( [%02X] , ATRBuffer[ATRLength] ); printk(\n); #endif memcpy( apdu.DataOut, ATRBuffer, ATRLength ); ret = copy_to_user((struct ozscr_apdu *)arg, apdu, sizeof(struct ozscr_apdu)); break; 1. This needs locking against concurrent ioctls 2. The interpretation of copy_to_user()'s return code is incorrect ret = copy_from_user(apdu, (struct ozscr_apdu *)arg, sizeof(struct ozscr_apdu)); You need to check ret, or you might write shit to the device pRdrExt-IOBase = (PSCR_REGISTERS *) dev-io_base; pRdrExt-membase = dev-am_base; pRdrExt-m_SCard.RqstProtocol = apdu.DataIn[6]; dprintk(membase:%p\n, pRdrExt-membase); dprintk(ioport:0x%03x\n, (unsigned)pRdrExt-IOBase); ret = CmdResetReader( pRdrExt, FALSE, ATRBuffer, ATRLength ); HTH Oliver - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
maybe post once more, and make clear whether you are looking for: - smart card reader support. (smart card as in digital signature card.) o2micro creates such readers, they are usualy usb devices, conform to the ccid standard and work fine (e.g. pcsc-lite plus ccid driver or openct). - smart media card / multi media card reader support (those small memory cards used by mobile phones, cameras and so on). o2micro creates those too, they are also build in by some vendors, but I'm not sure about their situation. also o2micro might also create pcmcia card readers for either. maybe let us know what kind of device you exactly have and how it is connected (if build in... lspci / lsusb would see pci or usb devices, pcmcia devices are found by the kernel I think). Regards, Andreas - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: O2micro smartcard reader driver.
On Tue, 28 Nov 2006 13:19:26 +0100 Andreas Jellinghaus [EMAIL PROTECTED] wrote: maybe post once more, and make clear whether you are looking for: Yep it's about a smartcard reader. This reader need a kernel module to be acceded by pcscd. also o2micro might also create pcmcia card readers for either. maybe let us know what kind of device you exactly have and how it is connected (if build in... lspci / lsusb would see pci or usb devices, pcmcia devices are found by the kernel I think). [EMAIL PROTECTED]:~$ lspcmcia - Socket 0 Bridge:[yenta_cardbus] (bus ID: :02:06.0) Configuration: state: on ready: unknown --none-- --none-- Socket 1 Bridge:[yenta_cardbus] (bus ID: :02:06.1) Configuration: state: on ready: unknown Voltage: 5.0V Vcc: 5.0V Vpp: 5.0V --none-- --none-- Socket 1 Device 0: [-- no driver --] (bus ID: 1.0) Configuration: state: on Product Name: O2Micro SmartCardBus Reader V1.0 Identification: manf_id: 0x card_id: 0x0001 prod_id(1): O2Micro (0x97299583) prod_id(2): SmartCardBus Reader (0xb8501ba9) prod_id(3): V1.0 (0xe611e659) prod_id(4): --- (---) Socket 2 Bridge:[yenta_cardbus] (bus ID: :02:06.3) Configuration: state: on ready: unknown Voltage: 5.0V Vcc: 5.0V Vpp: 5.0V --none-- --none-- Socket 2 Device 0: [-- no driver --] (bus ID: 2.0) Configuration: state: on Product Name: O2Micro SmartCardBus Reader V1.0 Identification: manf_id: 0x card_id: 0x0001 prod_id(1): O2Micro (0x97299583) prod_id(2): SmartCardBus Reader (0xb8501ba9) prod_id(3): V1.0 (0xe611e659) prod_id(4): --- (---) 02:06.0 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller 02:06.1 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller 02:06.2 System peripheral: O2 Micro, Inc. OZ711Mx 4-in-1 MemoryCardBus Accelerator 02:06.3 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
O2micro smartcard reader driver.
Hi, I found a thread (about one month old) about an OZ711Mx (O2micro mmc card reader) driver, but unfortunately it uses some closed-source code.[1] :( But I found no thread about the kernel driver for the O2micro PCMCIA smartcard reader. So I would like to know if there is any chance that this driver may be included in the mainline kernel. The source are LGPL'ed and available via the musclecard website[2]. And I found a patch to make it compile with kernel > 2.6.13 on the ubuntu support site[3]. AFAIK the module work, the only issue I have is a small hang when inserting a card in the reader. If some one could have a look at this. Regards Laurent Bigonville [1] http://lkml.org/lkml/2006/10/27/57 [2] ftp://scrdriver:[EMAIL PROTECTED]/Linux/O2Micro_PCMCIA_SCR_203_Linux_Kernel26_OpenSource.tar.gz [3] https://answers.launchpad.net/distros/ubuntu/+ticket/2535 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
O2micro smartcard reader driver.
Hi, I found a thread (about one month old) about an OZ711Mx (O2micro mmc card reader) driver, but unfortunately it uses some closed-source code.[1] :( But I found no thread about the kernel driver for the O2micro PCMCIA smartcard reader. So I would like to know if there is any chance that this driver may be included in the mainline kernel. The source are LGPL'ed and available via the musclecard website[2]. And I found a patch to make it compile with kernel 2.6.13 on the ubuntu support site[3]. AFAIK the module work, the only issue I have is a small hang when inserting a card in the reader. If some one could have a look at this. Regards Laurent Bigonville [1] http://lkml.org/lkml/2006/10/27/57 [2] ftp://scrdriver:[EMAIL PROTECTED]/Linux/O2Micro_PCMCIA_SCR_203_Linux_Kernel26_OpenSource.tar.gz [3] https://answers.launchpad.net/distros/ubuntu/+ticket/2535 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/