From sarumaru@yamayuri.org  Wed Sep 23 20:58:23 2009
Return-Path: <sarumaru@yamayuri.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CCB85106568F
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Sep 2009 20:58:23 +0000 (UTC)
	(envelope-from sarumaru@yamayuri.org)
Received: from yumi.yamayuri.org (unknown [IPv6:2001:380:e02:3f::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 71ED28FC1C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Sep 2009 20:58:23 +0000 (UTC)
Received: from yumi.yamayuri.org (sarumaru@localhost [127.0.0.1])
	by yumi.yamayuri.org (8.14.3/8.14.3) with ESMTP id n8NKwLlD004904
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Sep 2009 05:58:21 +0900 (JST)
	(envelope-from sarumaru@yamayuri.org)
Received: (from sarumaru@localhost)
	by yumi.yamayuri.org (8.14.3/8.14.3/Submit) id n8NKwL3B004903;
	Thu, 24 Sep 2009 05:58:21 +0900 (JST)
	(envelope-from sarumaru)
Message-Id: <200909232058.n8NKwL3B004903@yumi.yamayuri.org>
Date: Thu, 24 Sep 2009 05:58:21 +0900 (JST)
From: Yoshihiko Sarumaru <sarumaru@jp.FreeBSD.org>
Reply-To: Yoshihiko Sarumaru <sarumaru@jp.FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: update port: devel/libpasori: libusb issue
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         139094
>Category:       ports
>Synopsis:       update port: devel/libpasori: libusb issue
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 23 21:00:08 UTC 2009
>Closed-Date:    Thu Sep 24 13:57:03 UTC 2009
>Last-Modified:  Thu Sep 24 14:00:06 UTC 2009
>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@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:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Thu Sep 24 13:50:15 UTC 2009 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139094 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/139094: commit references a PR
Date: Thu, 24 Sep 2009 13:57:18 +0000 (UTC)

 pav         2009-09-24 13:56:50 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/libpasori      Makefile 
   Added files:
     devel/libpasori/files patch-libpasori_com_libusb.c 
   Log:
   - Add local hack to libusb backend too, bump portrevision
   - Correct typo
   
   PR:             ports/139094
   Submitted by:   Yoshihiko Sarumaru <sarumaru@jp.FreeBSD.org> (maintainer)
   Feature safe:   yes
   
   Revision  Changes    Path
   1.6       +3 -3      ports/devel/libpasori/Makefile
   1.1       +75 -0     ports/devel/libpasori/files/patch-libpasori_com_libusb.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
