From owner-FreeBSD-users-jp@jp.FreeBSD.org Fri Nov 28 19:44:09 2003
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id hASAi9382970;
	Fri, 28 Nov 2003 19:44:09 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from koganei-server.ohnolab.org (qmailr@koganei-server.ohnolab.org [202.249.37.99])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with SMTP/inet id hASAi8M82948
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Fri, 28 Nov 2003 19:44:08 +0900 (JST)
	(envelope-from kimoto@ohnolab.org)
Received: (qmail 21178 invoked from network); 28 Nov 2003 10:43:52 -0000
Received: from localhost (kimoto@127.0.0.1)
  by localhost with SMTP; 28 Nov 2003 10:43:52 -0000
Message-Id: <20031128.194130.45280227.kimoto@ohnolab.org>
To: FreeBSD-users-jp@jp.FreeBSD.org
From: Masahiko KIMOTO <kimoto@ohnolab.org>
In-Reply-To: <20031124.162616.70994158.kimoto@ohnolab.org>
References: <20031124.162616.70994158.kimoto@ohnolab.org>
X-fingerprint: DA 63 E3 AD 3F 30 98 05  EB CF 3C 06 2D FF 07 7F
X-PGP-Public-Key: http://www.ohnolab.org/~kimoto/kimoto.pubkey.asc
X-URL: http://www.ohnolab.org/~kimoto/
X-Mailer: Mew version 4.0.62 on Emacs 21.2.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Fri_Nov_28_19_41_30_2003_965)--"
Content-Transfer-Encoding: 7bit
Reply-To: FreeBSD-users-jp@jp.FreeBSD.org
Precedence: list
Date: Fri, 28 Nov 2003 19:41:30 +0900
X-Sequence: FreeBSD-users-jp 77379
Subject: [FreeBSD-users-jp 77379] Re: uvisor with Tungsten T on 4.9-RELEASE
Sender: owner-FreeBSD-users-jp@jp.FreeBSD.org
X-Originator: kimoto@ohnolab.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+031103

----Next_Part(Fri_Nov_28_19_41_30_2003_965)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

 > Palm Tungsten T($B=iBe(B)$B$rF~<j$7$^$7$?!#AaB.Jl4O$K$7$F$$$k(BFreeBSD 4.9-RELASE
 > $B$N%^%7%s$K7R$2$F$_$^$7$?$,!"0J2<$N$h$&$K(Battach$B$G<:GT$7$F;H$($^$;$s!#(B

$B0l1~;H$($k$h$&$K$7$F$_$^$7$?!#(B
NetBSD$B$G$O(Bbulk$BE>Aw$NAj<j$N8!=P$G(BVISOR$B$H(BPALM4$B$H$GJL$N=hM}$r$7$F$$$?$N$G!"(B
$B$=$l$K9g$o$;$F$_$^$7$?!#$,!"40A4$K(BNetBSD$B$HF1$8$K$O$J$C$F$$$^$;$s!#(B
NetBSD$B$N$[$&$O!"J#?t$N(Bport$B$,$"$k>l9g(B($B$C$F$N$,$I$&$$$&>l9g$+$OJ,$+$i$J$$(B
$B$N$G$9$,(B)$B$KJ#?t$N(Bucom$B$r(Battach$B$7$^$9$,!"(BFreeBSD$B$N$[$&$,#1$D$@$1$7$+(Battach
$B$7$^$;$s!#(B
$B$=$3$i$X$s$$$^$$$A$J$N$G!"$I$&$7$?$b$N$+$J$"$H;W$C$F$$$k$N$H!"B>$N(BPalm
$B%G%P%$%9$X$N1F6A$,J,$+$i$J$$$N$G!"(BCLIE$B$J$I$r;}$C$F$$$kJ}$O;n$7$F$_$F(B
$BD:$1$k$H$"$j$,$?$$$G$9!#(B

$B$b$7(BCLIE$B$G$&$^$/F0$+$J$$>l9g!"(B200$B9TL\$"$?$j$N(B
        {{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40 }, 0 },
        {{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41 }, 0 },
$B$N:G8e$N(B0$B$r(BPALM4$B$KCV$-49$($F$_$k$HD>$k$+$b$7$l$^$;$s!#(B
NetBSD$B$G$O$I$A$i$b(BPALM4$B$K$J$C$F$$$^$9!#(B

$BLdBj$J$1$l$P(Bsend-pr$B$9$k$+!"$=$NA0$K(Busb-bsd$B$KEj$2$F$_$k$+!"$A$g$C$H9M$($^$9!#(B

$B%Q%C%A$O(B4.9-RELEASE$B$N(Buvisor.c$B$+$i$N:9J,$G$9!#(B

----------------------------------------------------------------------
    $BLZK\(B $B2mI'(B <kimoto@ohnolab.org> :  http://www.ohnolab.org/~kimoto
----------------------------------------------------------------------

----Next_Part(Fri_Nov_28_19_41_30_2003_965)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="uvisor.c.diff"

*** uvisor.c.orig	Wed Jan  1 00:09:21 1997
--- uvisor.c	Fri Nov 28 19:25:14 2003
***************
*** 1,5 ****
  /*	$NetBSD: uvisor.c,v 1.9 2001/01/23 14:04:14 augustss Exp $	*/
! /*      $FreeBSD: src/sys/dev/usb/uvisor.c,v 1.7.2.6 2003/09/02 14:35:17 joe Exp $	*/
  
  /* This version of uvisor is heavily based upon the version in NetBSD
   * but is missing the following patches:
--- 1,5 ----
  /*	$NetBSD: uvisor.c,v 1.9 2001/01/23 14:04:14 augustss Exp $	*/
! /*      $FreeBSD: src/sys/dev/usb/uvisor.c,v 1.7.2.7 2003/11/12 00:19:50 joe Exp $	*/
  
  /* This version of uvisor is heavily based upon the version in NetBSD
   * but is missing the following patches:
***************
*** 140,147 ****
   * Unknown PalmOS stuff.
   */
  #define UVISOR_GET_PALM_INFORMATION		0x04
! #define UVISOR_GET_PALM_INFORMATION_LEN		0x14
  
  
  /*
   * Crank down UVISORBUFSIZE from 1024 to 64 to avoid a problem where
--- 140,158 ----
   * Unknown PalmOS stuff.
   */
  #define UVISOR_GET_PALM_INFORMATION		0x04
! #define UVISOR_GET_PALM_INFORMATION_LEN		0x44
  
+ struct uvisor_palm_connection_info {
+         uByte   num_ports;
+         uByte   endpoint_numbers_different;
+         uWord   reserved1;
+   struct {
+                 uDWord  port_function_id;
+                 uByte   port;
+                 uByte   end_point_info;
+                 uWord   reserved;
+   } connections[UVISOR_MAX_CONN];
+ };
  
  /*
   * Crank down UVISORBUFSIZE from 1024 to 64 to avoid a problem where
***************
*** 203,211 ****
  	struct usb_devno	uv_dev;
  	u_int16_t		uv_flags;
  #define PALM4	0x0001
  };
  static const struct uvisor_type uvisor_devs[] = {
! 	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_VISOR }, 0 },
  	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_M500 }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_M505 }, PALM4 },
--- 214,223 ----
  	struct usb_devno	uv_dev;
  	u_int16_t		uv_flags;
  #define PALM4	0x0001
+ #define VISOR   0x0002
  };
  static const struct uvisor_type uvisor_devs[] = {
! 	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_VISOR }, VISOR },
  	{{ USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_M500 }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_M505 }, PALM4 },
***************
*** 216,222 ****
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_Z }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_T }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_ZIRE }, PALM4 },
! 	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40 }, PALM4 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41 }, 0 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_S360 }, PALM4 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_NX60 }, PALM4 },
--- 228,234 ----
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_Z }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_T }, PALM4 },
  	{{ USB_VENDOR_PALM, USB_PRODUCT_PALM_ZIRE }, PALM4 },
! 	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40 }, 0 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41 }, 0 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_S360 }, PALM4 },
  	{{ USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_NX60 }, PALM4 },
***************
*** 284,290 ****
  		goto bad;
  	}
  
! 	printf("%s: %s\n", devname, devinfo);
  
  	sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags;
  
--- 296,302 ----
  		goto bad;
  	}
  
! /*	printf("%s: %s\n", devname, devinfo);*/
  
  	sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags;
  
***************
*** 395,415 ****
  	usbd_status err;
  	usb_device_request_t req;
  	struct uvisor_connection_info coninfo;
  	int actlen;
  	uWord avail;
  	char buffer[256];
  
! 	DPRINTF(("uvisor_init: getting connection info\n"));
! 	req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
! 	req.bRequest = UVISOR_GET_CONNECTION_INFORMATION;
! 	USETW(req.wValue, 0);
! 	USETW(req.wIndex, 0);
! 	USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
! 	err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo,
! 				    USBD_SHORT_XFER_OK, &actlen);
! 	if (err)
! 		return (err);
! 
  #ifdef USB_DEBUG
  	{
  		int i, np;
--- 407,429 ----
  	usbd_status err;
  	usb_device_request_t req;
  	struct uvisor_connection_info coninfo;
+ 	struct uvisor_palm_connection_info pconinfo;
  	int actlen;
  	uWord avail;
  	char buffer[256];
  
! 	if (sc->sc_flags & VISOR) { 
! 		DPRINTF(("uvisor_init: getting connection info\n"));
! 		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
! 		req.bRequest = UVISOR_GET_CONNECTION_INFORMATION;
! 		USETW(req.wValue, 0);
! 		USETW(req.wIndex, 0);
! 		USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
! 		err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo,
! 					    USBD_SHORT_XFER_OK, &actlen);
! 		if (err)
! 			return (err);
! 	}
  #ifdef USB_DEBUG
  	{
  		int i, np;
***************
*** 443,457 ****
  #endif
  
  	if (sc->sc_flags & PALM4) {
  		/* Palm OS 4.0 Hack */
  		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
  		req.bRequest = UVISOR_GET_PALM_INFORMATION;
  		USETW(req.wValue, 0);
  		USETW(req.wIndex, 0);
  		USETW(req.wLength, UVISOR_GET_PALM_INFORMATION_LEN);
! 		err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
  		if (err)
  			return (err);
  		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
  		req.bRequest = UVISOR_GET_PALM_INFORMATION;
  		USETW(req.wValue, 0);
--- 457,490 ----
  #endif
  
  	if (sc->sc_flags & PALM4) {
+ 	        int port;
  		/* Palm OS 4.0 Hack */
+ 	  	DPRINTF(("uvisor_init: getting Palm connection info\n"));
  		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
  		req.bRequest = UVISOR_GET_PALM_INFORMATION;
  		USETW(req.wValue, 0);
  		USETW(req.wIndex, 0);
  		USETW(req.wLength, UVISOR_GET_PALM_INFORMATION_LEN);
! 		err = usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &pconinfo,
! 					    USBD_SHORT_XFER_OK, &actlen);
  		if (err)
  			return (err);
+ 
+ 	  /*
+ 		printf("pconinfo.num_ports=%d\n",pconinfo.num_ports);
+ 		printf("pconinfo.endpoint_numbers_different=%d\n",pconinfo.endpoint_numbers_different);
+ 	   */
+ 
+ 		if (pconinfo.endpoint_numbers_different) {
+ 			port = pconinfo.connections[0].end_point_info;
+ 			sc->sc_ucom.sc_bulkin_no = (port >> 4) | UE_DIR_IN;
+ 			sc->sc_ucom.sc_bulkout_no = (port & 0xf) | UE_DIR_OUT;
+ 		} else {
+ 			port = pconinfo.connections[0].port;
+ 			sc->sc_ucom.sc_bulkin_no = port | UE_DIR_IN;
+ 			sc->sc_ucom.sc_bulkout_no = port | UE_DIR_OUT;
+ 		}
+ #if 0
  		req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
  		req.bRequest = UVISOR_GET_PALM_INFORMATION;
  		USETW(req.wValue, 0);
***************
*** 460,465 ****
--- 493,499 ----
  		err = usbd_do_request(sc->sc_ucom.sc_udev, &req, buffer);
  		if (err)
  			return (err);
+ #endif
  	}
  
  	DPRINTF(("uvisor_init: getting available bytes\n"));

----Next_Part(Fri_Nov_28_19_41_30_2003_965)----
