ports/139094: update port: devel/libpasori: libusb issue

Yoshihiko Sarumaru sarumaru at jp.FreeBSD.org
Wed Sep 23 21:00:10 UTC 2009


>Number:         139094
>Category:       ports
>Synopsis:       update port: devel/libpasori: libusb issue
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 23 21:00:08 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Yoshihiko Sarumaru
>Release:        FreeBSD 7.2-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD yumi.yamayuri.org 7.2-RELEASE-p1 FreeBSD 7.2-RELEASE-p1 #3: Thu Jun 11 00:54:54 JST 2009 root at yumi.yamayuri.org:/usr/obj/usr/src/sys/YUMI i386


	
>Description:
	libusb20 support for libpasori on 8.0 branch was added by stas@
	to be compiled with 8.0.
	On FreeBSD port, some hacks are adapted to libpasori_com_usbgen.c to
	detect PaSpRi (NFC reader/writer) automatically, but this feature was
	not applied to libpasori_com_libusb.c and it was needed by applications
	such as edyvalue or suicavalue.

	Also current Makefile has serious typo on installing lpdump and lptest.
	Obviously, lpdump and lptest are installed with wrong name each other.
>How-To-Repeat:
	
>Fix:

diff -urN libpasori.orig/Makefile libpasori/Makefile
--- libpasori.orig/Makefile	2009-09-24 05:42:52.000000000 +0900
+++ libpasori/Makefile	2009-09-24 05:44:15.000000000 +0900
@@ -6,7 +6,7 @@
 
 PORTNAME=	libpasori
 PORTVERSION=	02
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE_JP}
 MASTER_SITE_SUBDIR=	${PORTNAME}/20457
@@ -29,8 +29,8 @@
 .else
 	@${CP} ${FILESDIR}/Makefile.lib.usb20 ${WRKSRC}/lib/Makefile
 .endif
-	@${CP} ${FILESDIR}/Makefile.lpdump ${WRKSRC}/lpdump/Makefile
-	@${CP} ${FILESDIR}/Makefile.lptest ${WRKSRC}/lptest/Makefile
+	@${CP} ${FILESDIR}/Makefile.lpdump ${WRKSRC}/lptest/Makefile
+	@${CP} ${FILESDIR}/Makefile.lptest ${WRKSRC}/lpdump/Makefile
 
 post-install:
 	@${CAT} ${PKGMESSAGE}
diff -urN libpasori.orig/files/patch-libpasori_com_libusb.c libpasori/files/patch-libpasori_com_libusb.c
--- libpasori.orig/files/patch-libpasori_com_libusb.c	1970-01-01 09:00:00.000000000 +0900
+++ libpasori/files/patch-libpasori_com_libusb.c	2009-09-24 05:32:22.000000000 +0900
@@ -0,0 +1,75 @@
+--- src/libpasori_com_libusb.c.orig	2006-03-20 09:12:58.000000000 +0900
++++ src/libpasori_com_libusb.c	2009-03-09 03:11:29.000000000 +0900
+@@ -1,13 +1,14 @@
+ /* libpasori communicate LIBUSB ver. */
+ 
++#include <stdlib.h>
+ #include "libpasori_liblocal.h"
+-#include <usb.h>
+ 
+ #define PASORIUSB_VENDOR 0x054c
+-#define PASORIUSB_PRODUCT 0x01bb
++#define PASORIUSB_PRODUCT_RC_S310        0x006c
++#define PASORIUSB_PRODUCT_RC_S320        0x01bb
+ 
+ void dbg_dump(unsigned char *b,unsigned int size){
+-	int i;
++	unsigned int i;
+ 	if(size > 255) size = 255;
+ 	for(i=0;i!=size;i++){
+ 		Log("%02X ",b[i]);
+@@ -25,8 +26,8 @@
+ pasori* pasori_open(char *p){ /* FIXME: unused arg. */
+ 	struct usb_bus *bus;
+ 	struct usb_device *dev;
+-	pasori *pp;
+-	pp = (pasori *)malloc(sizeof(pasori));
++	pasori *pp = NULL;
++	(void)p;
+ 	usb_init();
+ #ifdef DEBUG
+ 	usb_set_debug(255);
+@@ -40,7 +41,8 @@
+ 		for(dev = bus->devices; dev ; dev = dev->next){
+ 			Log("check for %04x:%04x\n",dev->descriptor.idVendor,dev->descriptor.idProduct); /* debug */
+ 			if(dev->descriptor.idVendor == PASORIUSB_VENDOR &&
+-			   dev->descriptor.idProduct== PASORIUSB_PRODUCT){
++			   ((dev->descriptor.idProduct== PASORIUSB_PRODUCT_RC_S310) ||
++			    (dev->descriptor.idProduct== PASORIUSB_PRODUCT_RC_S320))){
+ 				goto finish;
+ 			}
+ 		}
+@@ -48,6 +50,7 @@
+ 	Log("pasori not found in USB BUS");
+ 	return NULL;
+ finish:
++	pp = (pasori *)malloc(sizeof(pasori));
+ 	pp->dh = usb_open(dev);
+ 	pp->dev= dev;
+ 	
+@@ -66,13 +69,13 @@
+ }
+ 
+ int pasori_send(pasori* pp,uint8* data,uint8 size,int timeout){ /* FIXME: ignore timeout */
+-	uint8 msg[256];
+ 	uint8 resp[256];
+ 	signed int i;
++	(void)timeout;
+ 	Log("(send) send:");
+ 	dbg_dump(data,size);
+-	i = usb_control_msg(pp->dh,USB_TYPE_VENDOR,0,0,0,data,size,400);
+-	i = usb_interrupt_read(pp->dh,0x81,resp,256,400);
++	i = usb_control_msg(pp->dh,USB_TYPE_VENDOR,0,0,0,(char*)data,size,400);
++	i = usb_interrupt_read(pp->dh,0x81,(char*)resp,256,400);
+ 	/* printf("i = %d",i); */ /* debug */
+ 	if(i<0) return 1; /* FIXME:HANDLE INVALID RESPONSES */
+ 	if(i!=6) return 1;
+@@ -88,7 +91,7 @@
+ 
+ int pasori_recv(pasori* pp,uint8* data,uint8 size,int timeout){
+ 	signed int i;
+-	i = usb_interrupt_read(pp->dh,0x81,data,size,timeout);
++	i = usb_interrupt_read(pp->dh,0x81,(char*)data,size,timeout);
+ 	if(i>0){
+ 		Log("(recv) recv:");
+ 		dbg_dump(data,i); 
	


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list