From nobody@FreeBSD.org  Sun Jan  8 18:50:02 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 24235106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  8 Jan 2012 18:50:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F5FC8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  8 Jan 2012 18:50:02 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q08Io1KK092548
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 8 Jan 2012 18:50:01 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q08Io1aC092547;
	Sun, 8 Jan 2012 18:50:01 GMT
	(envelope-from nobody)
Message-Id: <201201081850.q08Io1aC092547@red.freebsd.org>
Date: Sun, 8 Jan 2012 18:50:01 GMT
From: Bartosz Fabianowski <freebsd@chillt.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] [cam] Fix detection of LUN 1 for Garmin GPS devices
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163932
>Category:       kern
>Synopsis:       [PATCH] [cam] Fix detection of LUN 1 for Garmin GPS devices
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eadler
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 08 19:00:20 UTC 2012
>Closed-Date:    Wed Jun 06 06:41:32 UTC 2012
>Last-Modified:  Wed Jun 06 06:41:32 UTC 2012
>Originator:     Bartosz Fabianowski
>Release:        9-STABLE
>Organization:
>Environment:
>Description:
Recent Garmin GPS units present as two USB mass storage devices, representing internal storage (LUN 0) and SD card (LUN 1). However, the list of LUNs is incorrectly reported by the firmware so that FreeBSD sees LUN 0 only.

I noticed this problem with a Garmin Dakota 20:
http://lists.freebsd.org/pipermail/freebsd-usb/2012-January/010971.html

The same problem was as reported with a Garmin Edge 705:
http://lists.freebsd.org/pipermail/freebsd-scsi/2011-December/005159.html

The problem exists in FreeBSD 9 and 10.
>How-To-Repeat:
Plug in a Garmin GPS unit with two LUNs.

1. Notice that only one umass device appears.

2. Notice that "camcontrol reportluns" reports LUN 0 twice instead of LUN 0 and LUN 1:

%camcontrol reportluns da0
2 LUNs found
0
0
>Fix:
The attached patch enables the CAM_QUIRK_NOLUNS quirk. With this, FreeBSD assumes that the device's two LUNs are consecutively numbered and therefore correctly probes LUN 0 and LUN 1.

Patch attached with submission follows:

--- sys/cam/scsi/scsi_xpt.c.orig	2012-01-08 20:20:11.000000000 +0200
+++ sys/cam/scsi/scsi_xpt.c	2012-01-08 19:54:16.000000000 +0200
@@ -527,6 +527,10 @@
 		CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0
 	},
 	{
+		{ T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" },
+		  CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255
+	},
+	{
 		/* Default tagged queuing parameters for all devices */
 		{
 		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Thu May 10 18:16:21 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163932 
State-Changed-From-To: open->analyzed 
State-Changed-By: eadler 
State-Changed-When: Wed May 16 02:51:45 UTC 2012 
State-Changed-Why:  
awaiting approval 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163932: commit references a PR
Date: Wed, 30 May 2012 03:51:09 +0000 (UTC)

 Author: eadler
 Date: Wed May 30 03:50:58 2012
 New Revision: 236283
 URL: http://svn.freebsd.org/changeset/base/236283
 
 Log:
   Add support for newer garmin devices
   
   PR:		kern/163932
   Submitted by:	Bartosz Fabianowski <freebsd@chillt.de>
   Approved by:	cperciva
   MFC after:	1 week
 
 Modified:
   head/sys/cam/scsi/scsi_xpt.c
 
 Modified: head/sys/cam/scsi/scsi_xpt.c
 ==============================================================================
 --- head/sys/cam/scsi/scsi_xpt.c	Wed May 30 03:47:51 2012	(r236282)
 +++ head/sys/cam/scsi/scsi_xpt.c	Wed May 30 03:50:58 2012	(r236283)
 @@ -535,6 +535,10 @@ static struct scsi_quirk_entry scsi_quir
  		CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0
  	},
  	{
 +		{ T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" },
 +		CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255
 +	},
 +	{
  		/* Default tagged queuing parameters for all devices */
  		{
  		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: analyzed->patched 
State-Changed-By: eadler 
State-Changed-When: Wed May 30 04:17:14 UTC 2012 
State-Changed-Why:  
committed, awaiting MFC 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163932: commit references a PR
Date: Wed,  6 Jun 2012 04:26:23 +0000 (UTC)

 Author: eadler
 Date: Wed Jun  6 04:26:03 2012
 New Revision: 236653
 URL: http://svn.freebsd.org/changeset/base/236653
 
 Log:
   MFC r236283:
   	 Add support for newer garmin devices
   
   PR:		kern/163932
   Approved by:	cperciva (implicit)
 
 Modified:
   stable/9/sys/cam/scsi/scsi_xpt.c
 Directory Properties:
   stable/9/sys/   (props changed)
 
 Modified: stable/9/sys/cam/scsi/scsi_xpt.c
 ==============================================================================
 --- stable/9/sys/cam/scsi/scsi_xpt.c	Wed Jun  6 04:18:22 2012	(r236652)
 +++ stable/9/sys/cam/scsi/scsi_xpt.c	Wed Jun  6 04:26:03 2012	(r236653)
 @@ -535,6 +535,10 @@ static struct scsi_quirk_entry scsi_quir
  		CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0
  	},
  	{
 +		{ T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" },
 +		CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255
 +	},
 +	{
  		/* Default tagged queuing parameters for all devices */
  		{
  		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163932: commit references a PR
Date: Wed,  6 Jun 2012 04:26:41 +0000 (UTC)

 Author: eadler
 Date: Wed Jun  6 04:26:27 2012
 New Revision: 236654
 URL: http://svn.freebsd.org/changeset/base/236654
 
 Log:
   MFC r236283:
   	 Add support for newer garmin devices
   
   PR:		kern/163932
   Approved by:	cperciva (implicit)
 
 Modified:
   stable/8/sys/cam/scsi/scsi_xpt.c
 Directory Properties:
   stable/8/sys/   (props changed)
 
 Modified: stable/8/sys/cam/scsi/scsi_xpt.c
 ==============================================================================
 --- stable/8/sys/cam/scsi/scsi_xpt.c	Wed Jun  6 04:26:03 2012	(r236653)
 +++ stable/8/sys/cam/scsi/scsi_xpt.c	Wed Jun  6 04:26:27 2012	(r236654)
 @@ -507,6 +507,10 @@ static struct scsi_quirk_entry scsi_quir
  		CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0
  	},
  	{
 +		{ T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" },
 +		CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255
 +	},
 +	{
  		/* Default tagged queuing parameters for all devices */
  		{
  		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Wed Jun 6 06:41:28 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163932 
>Unformatted:
