Bug#366445: detection of PCMCIA readers

2006-05-18 Thread Thomas Viehmann
Hi Joachim,

Joachim Breitner wrote:
 I have hacked something up, based on your ttyusb code, and it seems to
 work here. I have attached the pcmciascanner* files I created. I hope
 you can use them and maybe forward them upstream.
thanks a bunch! I'll ask Martin to take a look.

This:
 /* this function has been submitted by Thomas Viehmann. Thanks ;-) */
has to go, though...

Kind regards

T.
-- 
Thomas Viehmann, http://thomas.viehmann.net/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#366445: detection of PCMCIA readers

2006-05-17 Thread Joachim Breitner
Hi Thomas,


Am Mittwoch, den 10.05.2006, 07:46 +0200 schrieb Thomas Viehmann:
 Joachim Breitner wrote:
  You are probably right. What is upstreams' position on that? Maybe they
  can implement that in the near future.
 Well, last time something like this came up (with ttyusb detection), it
 was patches accepted, which is why I tagged this bug accordingly.

I have hacked something up, based on your ttyusb code, and it seems to
work here. I have attached the pcmciascanner* files I created. I hope
you can use them and maybe forward them upstream.

Greetings,
Joachim
-- 
Joachim nomeata Breitner
Debian Developer
  [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: [EMAIL PROTECTED] | http://people.debian.org/~nomeata

/***
 $RCSfile$
 ---
cvs : $Id: usbttyscanner.c 178 2006-04-28 22:22:36Z martin $
begin   : Mon Mar 01 2004
copyright   : (C) 2004 by Martin Preuss
email   : [EMAIL PROTECTED]

 ***
 *  Please see toplevel file COPYING for license details   *
 ***/

#ifdef HAVE_CONFIG_H
# include config.h
#endif


#include pcmciascanner_p.h
#include gwenhywfar/debug.h
#include gwenhywfar/misc.h
#include gwenhywfar/directory.h
#include gwenhywfar/buffer.h
#include gwenhywfar/stringlist.h


#include stdlib.h
#include assert.h
#include string.h
#include errno.h

#ifdef USE_LIBSYSFS
# include sysfs/libsysfs.h
#endif


LC_DEVSCANNER *LC_PcmciaScanner_new() {
  LC_DEVSCANNER *sc;
#ifdef USE_LIBSYSFS
  char sysfspath[256];
#endif

  sc=LC_DevScanner_new();
  LC_DevScanner_SetReadDevsFn(sc, LC_PcmciaScanner_ReadDevs);

#ifdef USE_LIBSYSFS
  if (! sysfs_get_mnt_path(sysfspath, sizeof(sysfspath))) {
DBG_NOTICE(0, Will use sysfs to scan for ttyUSB devices)
  }
#endif

  return sc;
}



/* this function has been submitted by Thomas Viehmann. Thanks ;-) */
int LC_PcmciaScanner_ScanSysFS_Pcmcia(LC_DEVICE_LIST *dl) {
#ifndef USE_LIBSYSFS
  DBG_INFO(0, LibSysFS not supsknumed);
  return -1;
#else
  struct sysfs_bus *bus = NULL;
  struct sysfs_device *curdev = NULL;
#ifndef HAVE_SYSFS2
  struct sysfs_device *temp_device = NULL;
#endif
  struct sysfs_attribute *cur = NULL;
  struct dlist *devlist = NULL;
  struct dlist *attributes = NULL;
  int sknum=0, vendorId=0, productId=0;
  LC_DEVICE *currentDevice;

  bus = sysfs_open_bus(pcmcia);
  if (bus == NULL) {
DBG_ERROR(0,Error accessing sysfs);
return -1;
  }

  devlist = sysfs_get_bus_devices(bus);
  if (devlist != NULL) {
dlist_for_each_data(devlist, curdev, 
struct sysfs_device) {
	  sknum = strtol(curdev-bus_id, NULL, 16);
  attributes = sysfs_get_device_attributes(curdev);
  dlist_for_each_data(attributes, cur, 
  struct sysfs_attribute) {
if (strcmp(cur-name,manf_id)==0) {
  if (cur-value != NULL) {
vendorId = strtol(cur-value, NULL, 16);
  }
  else {
		DBG_ERROR(0,manf_id empty);
	  }
	}
if (strcmp(cur-name,card_id)==0) {
  if (cur-value != NULL) {
productId = strtol(cur-value, NULL, 16);
  }
	  else {
		DBG_ERROR(0, card_id empty);
	  }
}
  }
  currentDevice=LC_Device_new(LC_Device_BusType_Pcmcia,
  0,
  sknum,
  vendorId, productId);
  DBG_DEBUG(0, Adding device %d (%04x/%04x),
sknum,
vendorId,
productId);
  LC_Device_SetDevicePos(currentDevice, sknum);
  LC_Device_List_Add(currentDevice, dl);
}	  
  }
  sysfs_close_bus(bus);
  return 0;
#endif
}


int LC_PcmciaScanner_ReadDevs(LC_DEVSCANNER *sc, LC_DEVICE_LIST *dl) {
  if ( LC_PcmciaScanner_ScanSysFS_Pcmcia(dl) ) {
DBG_DEBUG(0, here);
return -1;
  }

  return 0;
}



/***
 $RCSfile$
 ---
cvs : $Id: pcmciascanner_l.h 123 2005-10-22 00:45:35Z aquamaniac $
begin   : Mon Mar 01 2004
copyright   : (C) 2004 by Martin Preuss
email   : [EMAIL PROTECTED]

 ***
 *  Please see toplevel file COPYING for license details   *
 ***/


#ifndef CHIPCARD_SERVER_PCMCIASCANNER_L_H
#define CHIPCARD_SERVER_PCMCIASCANNER_L_H

#include devmonitor.h


LC_DEVSCANNER *LC_PcmciaScanner();




#endif /* CHIPCARD_SERVER_PCMCIASCANNER_L_H */

Bug#366445: detection of PCMCIA readers

2006-05-09 Thread Thomas Viehmann
# this is a feature request
severity 366445 wishlist
# see text for this
tag 366455 + wontfix help
thanks

Hi Joachim,

Joachim Breitner wrote:
 I managed to compile chipcardd2 with PCMCIA-Scanning by adding the
 kernel source to the configure flags. Note that you have to put cdbs

kernel headers are a no-go, so I'm tagging this bug wontfix.

Probably it would be best to look into pcmciautils and see if its
possible to reimplement the pcmcia scanner with sysfs (if lspcmcia can
use libsysfs instead of kernel-headers, so should anyone else...).
As I don't have a pcmcia card reader, I'm not able to do this.
You might be able to use the corresponding function in usbttyscanner.c
as an example how to use libsysfs. It's not hard, just somewhat
ill-documented.

Anyone who wants to send in a patch that switches pcmciascanner to
libsysfs should not hesitate to do so. Note that I'm not willing to
entertain patches copying the kernel headers or somesuch unless it is
demonstrated that libsysfs is not an option.

Kind regards

T.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#366445: detection of PCMCIA readers

2006-05-09 Thread Joachim Breitner
Hi,

Am Dienstag, den 09.05.2006, 09:31 +0200 schrieb Thomas Viehmann:
 Probably it would be best to look into pcmciautils and see if its
 possible to reimplement the pcmcia scanner with sysfs (if lspcmcia can
 use libsysfs instead of kernel-headers, so should anyone else...).
 As I don't have a pcmcia card reader, I'm not able to do this.
 You might be able to use the corresponding function in usbttyscanner.c
 as an example how to use libsysfs. It's not hard, just somewhat
 ill-documented.

You are probably right. What is upstreams' position on that? Maybe they
can implement that in the near future.

Greetings,
Joachim

-- 
Joachim nomeata Breitner
Debian Developer
  [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: [EMAIL PROTECTED] | http://people.debian.org/~nomeata



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Bug#366445: detection of PCMCIA readers

2006-05-09 Thread Thomas Viehmann
Joachim Breitner wrote:
 You are probably right. What is upstreams' position on that? Maybe they
 can implement that in the near future.
Well, last time something like this came up (with ttyusb detection), it
was patches accepted, which is why I tagged this bug accordingly.

Kind regards

T.
-- 
Thomas Viehmann, http://thomas.viehmann.net/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]