Re: sierra wireless compass 597 aircard (Was: Documentation)

2008-05-07 Thread Steve Clark

Fredrik Lindberg wrote:

Marcin Cieslak wrote:


It maybe a good idea to add 0xFFF to the usbdevs.
Does the umass driver  attach to the 0xFFF device? I would recommend 
adding this as a quirk to umass.c then.


There are patches attached (ubsa.c_patch, umass_c.patch, usbdevs.patch) 
I am using to kill the zeroconf CD on the UMTS. They do not always 
work - i.e. umass_attach does not wait until the device is really 
detached. But setting USB_DEBUG helps :-)





Since your patches deals with Option cards I'll just let you know that
all(?) Option based devices can be switched perfectly safe from
user land, without patching ubsa, using camcontrol.
The command to switch Option devices is a SCSI REZERO command.

This should be enough to switch the device, given that pass0
is the modem (use camcontrol devlist)

camcontrol cmd pass0 -c “01 00 00 00 00 00″ -i 1 i1

camcontrol might give you an error but the device will be switched.
Note that this is ONLY for Option based devices, I don't know about
the Sierra ones but the linux usb_modeswitch tool might be a good start.

Fredrik

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to [EMAIL PROTECTED]



Hi Fredrik,

This does not seem to work for me with the sierra usb device.
usbdevs -v
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x), VIA(0x), 
rev 1.00
port 1 powered
port 2 addr 2: full speed, power 100 mA, config 1, USB MMC Storage(0x0fff), 
Sierra Wireless(0x1199), rev 0.00

camcontrol devlist -v
scbus0 on umass-sim0 bus 0:
Aircard TRU-Install 2.31 at scbus0 target 0 lun 0 (cd0,pass0)
Sierra Wireless Storage 2.31 at scbus0 target 0 lun 1 (pass1,da0)

camcontrol cmd pass1 -c '01 00 00 00 00 00' -i 1 i1
camcontrol: error sending command
[EMAIL PROTECTED] /usr/ports]# camcontrol devlist -v
scbus0 on umass-sim0 bus 0:
Aircard TRU-Install 2.31 at scbus0 target 0 lun 0 (cd0,pass0)
Sierra Wireless Storage 2.31 at scbus0 target 0 lun 1 (pass1,da0)

Still shows as cd device.

usbdevs -v
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x), VIA(0x), 
rev 1.00
port 1 powered
port 2 addr 2: full speed, power 100 mA, config 1, USB MMC Storage(0x0fff), 
Sierra Wireless(0x1199), rev 0.00

Thanks,
Steve


___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: sierra wireless compass 597 aircard (Was: Documentation)

2008-05-05 Thread Steve Clark

Marcin Cieslak wrote:

Steve Clark wrote:

Is there any detailed documentation on the FreeBSD usb device driver 
api?



This chapter helped me a lot to understand how this all works:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/usb.html


I sort of have it working by hacking ubsa.c to look for the sierra 
vendor id and product id of 0xfff in
the usb_match function and return match. Then in the usb_attach code I 
look again for the vendor and
product id of 0xfff and then send the control message to put it in modem 
mode.

   if ( uaa-vendor == USB_VENDOR_SIERRA  uaa-product == 0xfff )



It maybe a good idea to add 0xFFF to the usbdevs.
Does the umass driver  attach to the 0xFFF device? I would recommend 
adding this as a quirk to umass.c then.


Actually I am not sure. The device when in TRU-Install mode looks like umass 
device,
it has a place to insert a microSD card, and also cdrom drive that when mounted 
has
the software to install on windows. When it is put in modem mode the cdrom 
disappears
but the umass device is still there. One other thing is that when installed on 
a linux
system there are 3 serial ports. The first port is used for the modem, one is 
used for a
builtin gps receiver and I think the 3rd passes signal strength information to 
the windows
software. 


There are patches attached (ubsa.c_patch, umass_c.patch, usbdevs.patch) 
I am using to kill the zeroconf CD on the UMTS. They do not always 
work - i.e. umass_attach does not wait until the device is really 
detached. But setting USB_DEBUG helps :-)




   {
   ubsa_request_real( sc, 0x0b, 1, 0x40 );
   ucom-sc_dying = 1;
   goto error;
   }



This puts in modem mode with product id of 0x0023 which i have plugged 
into usbdevs and also put in ubsa.c
so now I get a ucom device and can successfully run ppp. The problem I 
am running into now is sometime after
it remove the device I will get a page fault panic in the kernel. 



What kind of panic is this?



I think it is related to the sending the
control_message - something is not cleaned up when I goto error in the 
USB_ATTACH function.




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


Yeah this looks like the panic I am getting. One of my fellow workers needed the
usb device - so I am waiting for us to get another to continue testing.



There are two patches, one to ohci_pci.c, the other to usb_subr.c. One 
of them is not correct - after kldunloading the module you may run into 
problems. But it makes everyday life easier - at least you can remove 
the card and re-insert.


And finally, you will need something to increase your ubsa buffers, I am 
using the ubsa.c_buffers_patch attached. (Crude, but cleaner than

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


For the time being I just hard coded larger buffers - like I see you did below.

Thanks for your input. When I get my replacement modem I'll let you know
how I make out.


--Marcin



SNIP
 


I am attaching an lsusb listing from a linux system FYI.

Thanks,
Steve

Bus 003 Device 004: ID 1199:0023 Sierra Wireless, Inc. 
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   1.10
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0 
  bDeviceProtocol 0 
  bMaxPacketSize064
  idVendor   0x1199 Sierra Wireless, Inc.
  idProduct  0x0023 
  bcdDevice0.02
  iManufacturer   1 Sierra Wireless, Incorporated
  iProduct2 Sierra Wireless Compass 597 EVDO Modem
  iSerial 0 
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   90
bNumInterfaces  2
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0xe0
  Self Powered
  Remote Wakeup
MaxPower0mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   7
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass255 Vendor Specific Subclass
  bInterfaceProtocol255 Vendor Specific Protocol
  iInterface  3 Data Interface
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0010  1x 16 bytes
bInterval 128
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  

Re: sierra wireless compass 597 aircard (Was: Documentation)

2008-05-03 Thread Marcin Cieslak

Fredrik Lindberg wrote:


This should be enough to switch the device, given that pass0
is the modem (use camcontrol devlist)

camcontrol cmd pass0 -c “01 00 00 00 00 00″ -i 1 i1

camcontrol might give you an error but the device will be switched.
Note that this is ONLY for Option based devices, I don't know about
the Sierra ones but the linux usb_modeswitch tool might be a good start.


Yes, this is option-specific. Last time I tried this command, it panics 
the system. That's why I patched umass to do this for me at the attach time.


However, feel free to try other patches since they are not 
option-specific in any way.


--Marcin



signature.asc
Description: OpenPGP digital signature


Re: sierra wireless compass 597 aircard (Was: Documentation)

2008-05-02 Thread Marcin Cieslak

Steve Clark wrote:
Is there any detailed documentation on the FreeBSD usb device driver 
api?


This chapter helped me a lot to understand how this all works:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/usb.html

I sort of have it working by hacking ubsa.c to look for the sierra 
vendor id and product id of 0xfff in
the usb_match function and return match. Then in the usb_attach code I 
look again for the vendor and
product id of 0xfff and then send the control message to put it in modem 
mode.

if ( uaa-vendor == USB_VENDOR_SIERRA  uaa-product == 0xfff )


It maybe a good idea to add 0xFFF to the usbdevs.
Does the umass driver  attach to the 0xFFF device? I would recommend 
adding this as a quirk to umass.c then.


There are patches attached (ubsa.c_patch, umass_c.patch, usbdevs.patch) 
I am using to kill the zeroconf CD on the UMTS. They do not always 
work - i.e. umass_attach does not wait until the device is really 
detached. But setting USB_DEBUG helps :-)



{
ubsa_request_real( sc, 0x0b, 1, 0x40 );
ucom-sc_dying = 1;
goto error;
}


This puts in modem mode with product id of 0x0023 which i have plugged 
into usbdevs and also put in ubsa.c
so now I get a ucom device and can successfully run ppp. The problem I 
am running into now is sometime after
it remove the device I will get a page fault panic in the kernel. 


What kind of panic is this?


I think it is related to the sending the
control_message - something is not cleaned up when I goto error in the 
USB_ATTACH function.



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

There are two patches, one to ohci_pci.c, the other to usb_subr.c. One 
of them is not correct - after kldunloading the module you may run into 
problems. But it makes everyday life easier - at least you can remove 
the card and re-insert.


And finally, you will need something to increase your ubsa buffers, I am 
using the ubsa.c_buffers_patch attached. (Crude, but cleaner than

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

--Marcin
--- /sys/dev/usb/ubsa.c 2007-06-22 07:56:05.0 +0200
+++ ubsa.c  2008-01-03 11:53:09.740739801 +0100
@@ -232,6 +232,8 @@
{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },
/* Option GlobeTrotter 3G+ */
{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS },
+   /* Option GlobeTrotter Max 3.6 */
+   { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 },
/* Huawei Mobile */
{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },
{ 0, 0 }
--- /sys/dev/usb/umass.c2007-07-05 07:26:08.0 +0200
+++ umass.c 2008-01-03 11:53:13.592156965 +0100
@@ -323,6 +323,8 @@
 * sector number.
 */
 #  define READ_CAPACITY_OFFBY1 0x2000
+   /* Needs to be initialised the Qualcomm way */
+#  define TURNOFF_FLASH0x4000
 };
 
 static struct umass_devdescr_t umass_devdescrs[] = {
@@ -636,6 +638,10 @@
  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
  IGNORE_RESIDUE | NO_START_STOP
},
+   { USB_VENDOR_QUALCOMM2, USB_PRODUCT_QUALCOMM2_MMC, RID_WILDCARD,
+ UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+ TURNOFF_FLASH
+   },
{ USB_VENDOR_SAMSUNG,  USB_PRODUCT_SAMSUNG_YP_U2, RID_WILDCARD,
  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
  SHUTTLE_INIT | NO_GETMAXLUN
@@ -1027,6 +1033,8 @@
 
 /* quirk functions */
 static void umass_init_shuttle (struct umass_softc *sc);
+static void umass_turnoff_flash (struct umass_softc *sc);
+static void umass_turnoff_flash_cb(struct umass_softc *sc, void *priv, int 
residue, int status);
 
 /* generic transfer functions */
 static usbd_status umass_setup_transfer(struct umass_softc *sc,
@@ -1472,6 +1480,13 @@
 
if (sc-quirks  SHUTTLE_INIT)
umass_init_shuttle(sc);
+   if (sc-quirks  TURNOFF_FLASH) {
+   DPRINTF(UDMASS_USB, (%s: Detaching MMC\n,
+   device_get_nameunit(sc-sc_dev)));
+   umass_turnoff_flash(sc);
+   umass_detach(self);
+   return ENXIO;
+   }
 
/* Get the maximum LUN supported by the device.
 */
@@ -1576,6 +1591,21 @@
device_get_nameunit(sc-sc_dev), status[0], status[1]));
 }
 
+static void
+umass_turnoff_flash(struct umass_softc *sc)
+{
+   static uint8_t cmd[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
+   umass_bbb_transfer(sc, 0, cmd, sizeof(cmd),
+   NULL, 0, DIR_NONE, 0,
+   umass_turnoff_flash_cb, NULL);
+}
+
+static void
+umass_turnoff_flash_cb(struct umass_softc *sc, void *priv, int residue, int 
status)
+{
+   /* Do nothing */
+}
+
  /*
  * Generic functions to handle transfers
  */
--- ubsa.c.orig 2008-03-08 04:22:00.333020955 +0100
+++ ubsa.c  2008-03-12 01:20:07.045184146 +0100
@@ -360,15 +360,15 @@
if (UE_GET_DIR(ed-bEndpointAddress) == UE_DIR_IN