Hello all,

I am trying to write an USB device driver for the Mustek GSmart 350 Digital
Camera. According to Mustek this camera uses simple BULK transfers and
therefore I tried to change the device driver of the Kodak dc2xx series a
bit. Now I stucked with the following problem:

Sending strings to the camera does not fail, but every time I try to set up
an read URB, I get errors (timeout).

At this point I wasn't sure about the protocol information I got from
Mustek, Taiwan and so I verified the protocol with a sniffer (I'll attach
the log). In this protocol I found strange power management messages and
thus I did talk to the programmer of the sniffer.
He said the IRP_MJ_POWER message tries to turn on the device (PowerDeviceD0
= totally on).  Now I am not sure if and how I have to implement this. Are
there such power management functions?

Every help would be very appreciated.

Thanks,
   Andreas

---
Andreas Nuechter
   ...student of computer science at University of Bonn
Prinz-Albert-Str. 42
53113 Bonn, Germany
+49-228-9140190
[EMAIL PROTECTED] - http://www-student.cs.bonn.edu/~nuechte
ICQ# 19506497

*****
Here is how I build the URBs:
*****
 purb_t  write_urb;
 char*   write_urb_buffer;
 purb_t  download_urb;
 char*   download_urb_buffer;

 /* Setup URB Structs */
 FILL_BULK_URB (
  GSmart->write_urb,
  GSmart->dev,
  usb_sndbulkpipe (GSmart->dev, GSmart->endpoint[1]),
  GSmart->write_urb_buffer,
  64,
  GSmart_usb_write_notify,
  GSmart
 );

 FILL_BULK_URB (
  GSmart->download_urb,
  GSmart->dev,
  usb_rcvbulkpipe (GSmart->dev, GSmart->endpoint[2]),
  GSmart->download_urb_buffer,
  64,
  GSmart_usb_download_notify,
  GSmart
 );
*****
And here is the sniffer protocol
*****


00000000 0.00000000 UsbSnoop - IRP_MJ_PNP (IRP_MN_QUERY_REMOVE_DEVICE)
00000001 0.28753680 UsbSnoop - IRP_MJ_POWER (IRP_MN_SET_POWER),
SystemContext 4D505950, DevicePowerState = PowerDeviceD0
00000002 0.63462400 UsbSnoop - IRP_MJ_PNP (IRP_MN_REMOVE_DEVICE)
00000003 0.63560240 UsbSnoop - Entering DriverUnload: DriverObject C15D95B8
00000004 0.63944400 [Sniffusb] Locking CM...
00000005 0.63946320 [Sniffusb] About to do ReEnumerateDevNode()...
00000006 8.29337520 [Sniffusb] About to do ProcessEventsNow()...
00000007 8.29527680 [Sniffusb] Unlocking CM...
00000008 8.29529520 [Sniffusb] Closing CM...
00000009 8.97257920 UsbSnoop 0.12 - Entering DriverEntry: DriverObject
C160EF08
00000010 8.97259280 UsbSnoop - Running under Windows 98
00000011 8.97262320 UsbSnoop - Entering AddDevice: DriverObject C160EF08,
pdo C1442088
00000012 8.99405840 UsbSnoop - IRP_MJ_PNP
(IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
00000013 8.99418480 UsbSnoop - IRP_MJ_PNP (IRP_MN_START_DEVICE)
00000014 9.16978560 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000015 9.16979760
00000016 9.16980320 >>>>>>> URB 1 going down...
00000017 9.16981680 -- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
00000018 9.16982880   TransferBufferLength = 00000012
00000019 9.16984160   TransferBuffer       = c15f8b80
00000020 9.16985200   TransferBufferMDL    = 00000000
00000021 9.16986400   Index                = 00
00000022 9.16987840   DescriptorType       = 01
(USB_DEVICE_DESCRIPTOR_TYPE)
00000023 9.16988960   LanguageId           = 0000
00000024 9.17548720
00000025 9.17549200 <<<<<<< URB 1 coming back...
00000026 9.17550400 -- URB_FUNCTION_CONTROL_TRANSFER:
00000027 9.17551680   PipeHandle           = c15e47cc
00000028 9.17553600   TransferFlags        = 00000003
(USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
00000029 9.17554800   TransferBufferLength = 00000012
00000030 9.17556000   TransferBuffer       = c15f8b80
00000031 9.17557200   TransferBufferMDL    = c15f8cc0
00000032 9.17558000
00000033 9.17558400     0000:
00000034 9.17565600  12 01 00 01 00 00 00 08 5f 05 50 a3 00 01 00 00
00000035 9.17566000     0010:
00000036 9.17567280  00 01
00000037 9.17568400   UrbLink              = 00000000
00000038 9.17572960   SetupPacket          : 80 06 00 01 00 00 12 00
00000039 9.17576000 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000040 9.17577120
00000041 9.17577520 >>>>>>> URB 2 going down...
00000042 9.17578880 -- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
00000043 9.17580080   TransferBufferLength = 00000209
00000044 9.17581280   TransferBuffer       = c15e6c20
00000045 9.17582400   TransferBufferMDL    = 00000000
00000046 9.17583520   Index                = 00
00000047 9.17584960   DescriptorType       = 02
(USB_CONFIGURATION_DESCRIPTOR_TYPE)
00000048 9.17586080   LanguageId           = 0000
00000049 9.19552720
00000050 9.19553200 <<<<<<< URB 2 coming back...
00000051 9.19554400 -- URB_FUNCTION_CONTROL_TRANSFER:
00000052 9.19555680   PipeHandle           = c15e47cc
00000053 9.19557600   TransferFlags        = 00000003
(USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
00000054 9.19558720   TransferBufferLength = 00000081
00000055 9.19559920   TransferBuffer       = c15e6c20
00000056 9.19561200   TransferBufferMDL    = c15f8cc0
00000057 9.19562000
00000058 9.19562400     0000:
00000059 9.19569520  09 02 81 00 01 00 00 80 96 09 04 00 00 03 00 00
00000060 9.19569920     0010:
00000061 9.19576960  00 00 07 05 01 03 10 00 0a 07 05 02 02 40 00 01
00000062 9.19577360     0020:
00000063 9.19584320  07 05 83 02 40 00 01 09 04 00 01 03 00 00 00 00
00000064 9.19584800     0030:
00000065 9.19591760  07 05 01 03 10 00 0a 07 05 02 02 40 00 01 07 05
00000066 9.19592160     0040:
00000067 9.19599120  03 02 40 00 01 09 04 00 02 03 00 00 00 00 07 05
00000068 9.19599520     0050:
00000069 9.19606560  01 03 10 00 0a 07 05 02 02 40 00 01 07 05 83 01
00000070 9.19606960     0060:
00000071 9.19613920  f0 03 01 09 04 00 03 03 00 00 00 00 07 05 01 03
00000072 9.19614320     0070:
00000073 9.19621360  10 00 0a 07 05 82 02 40 00 01 07 05 03 01 f0 03
00000074 9.19621760     0080:
00000075 9.19622640  01
00000076 9.19623760   UrbLink              = 00000000
00000077 9.19628320   SetupPacket          : 80 06 00 02 00 00 09 02
00000078 9.19631680 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000079 9.19632800
00000080 9.19633200 >>>>>>> URB 3 going down...
00000081 9.19634480 -- URB_FUNCTION_SELECT_CONFIGURATION:
00000082 9.19636000   ConfigurationDescriptor = 0xc15e6c20 (configure)
00000083 9.19637520   ConfigurationDescriptor : bLength             = 0x09
00000084 9.19639120   ConfigurationDescriptor : bDescriptorType     = 0x02
00000085 9.19640640   ConfigurationDescriptor : wTotalLength        =
0x0081
00000086 9.19642160   ConfigurationDescriptor : bNumInterfaces      = 0x01
00000087 9.19643680   ConfigurationDescriptor : bConfigurationValue = 0x00
00000088 9.19645200   ConfigurationDescriptor : iConfiguration      = 0x00
00000089 9.19646720   ConfigurationDescriptor : bmAttributes        = 0x80
00000090 9.19648320   ConfigurationDescriptor : MaxPower            = 0x96
00000091 9.19649520   ConfigurationHandle     = 0x000005b5
00000092 9.19650960   Interface[0]: Length            = 0x0000004c
00000093 9.19652320   Interface[0]: InterfaceNumber   = 0x00
00000094 9.19653680   Interface[0]: AlternateSetting  = 0x00
00000095 9.20232800
00000096 9.20233280 <<<<<<< URB 3 coming back...
00000097 9.20234560 -- URB_FUNCTION_SELECT_CONFIGURATION:
00000098 9.20236000   ConfigurationDescriptor = 0xc15e6c20 (configure)
00000099 9.20237520   ConfigurationDescriptor : bLength             = 0x09
00000100 9.20239040   ConfigurationDescriptor : bDescriptorType     = 0x02
00000101 9.20240560   ConfigurationDescriptor : wTotalLength        =
0x0081
00000102 9.20242080   ConfigurationDescriptor : bNumInterfaces      = 0x01
00000103 9.20243600   ConfigurationDescriptor : bConfigurationValue = 0x00
00000104 9.20245040   ConfigurationDescriptor : iConfiguration      = 0x00
00000105 9.20246560   ConfigurationDescriptor : bmAttributes        = 0x80
00000106 9.20248080   ConfigurationDescriptor : MaxPower            = 0x96
00000107 9.20249360   ConfigurationHandle     = 0xc18be5f0
00000108 9.20250800   Interface[0]: Length            = 0x0000004c
00000109 9.20252160   Interface[0]: InterfaceNumber   = 0x00
00000110 9.20253440   Interface[0]: AlternateSetting  = 0x00
00000111 9.20254800   Interface[0]: Class             = 0x00
00000112 9.20256080   Interface[0]: SubClass          = 0x00
00000113 9.20257440   Interface[0]: Protocol          = 0x00
00000114 9.20258960   Interface[0]: InterfaceHandle   = 0xc15dbf00
00000115 9.20260400   Interface[0]: NumberOfPipes     = 0x00000003
00000116 9.20261920   Interface[0]: Pipes[0] : MaximumPacketSize = 0x0010
00000117 9.20264960   Interface[0]: Pipes[0] : EndpointAddress   = 0x01
00000118 9.20266560   Interface[0]: Pipes[0] : Interval          = 0x0a
00000119 9.20268560   Interface[0]: Pipes[0] : PipeType          = 0x03
(UsbdPipeTypeInterrupt)
00000120 9.20270240   Interface[0]: Pipes[0] : PipeHandle        =
0xc15dbf18
00000121 9.20271920   Interface[0]: Pipes[0] : MaxTransferSize   =
0x000c8000
00000122 9.20273520   Interface[0]: Pipes[0] : PipeFlags         = 0x00
00000123 9.20275120   Interface[0]: Pipes[1] : MaximumPacketSize = 0x0040
00000124 9.20276640   Interface[0]: Pipes[1] : EndpointAddress   = 0x02
00000125 9.20278160   Interface[0]: Pipes[1] : Interval          = 0x01
00000126 9.20279920   Interface[0]: Pipes[1] : PipeType          = 0x02
(UsbdPipeTypeBulk)
00000127 9.20281680   Interface[0]: Pipes[1] : PipeHandle        =
0xc15dbf2c
00000128 9.20283360   Interface[0]: Pipes[1] : MaxTransferSize   =
0x000c8000
00000129 9.20284880   Interface[0]: Pipes[1] : PipeFlags         = 0x00
00000130 9.20286480   Interface[0]: Pipes[2] : MaximumPacketSize = 0x0040
00000131 9.20288000   Interface[0]: Pipes[2] : EndpointAddress   = 0x83
00000132 9.20289600   Interface[0]: Pipes[2] : Interval          = 0x01
00000133 9.20291360   Interface[0]: Pipes[2] : PipeType          = 0x02
(UsbdPipeTypeBulk)
00000134 9.20293040   Interface[0]: Pipes[2] : PipeHandle        =
0xc15dbf40
00000135 9.20294720   Interface[0]: Pipes[2] : MaxTransferSize   =
0x000c8000
00000136 9.20296240   Interface[0]: Pipes[2] : PipeFlags         = 0x00
00000137 9.20298800 UsbSnoop - IRP_MJ_PNP (IRP_MN_QUERY_CAPABILITIES)
00000138 9.20304560 UsbSnoop - IRP_MJ_PNP (IRP_MN_QUERY_PNP_DEVICE_STATE)
00000139 9.46203760 UsbSnoop - IRP_MJ_PNP (IRP_MN_QUERY_DEVICE_RELATIONS)
00000140 27.35264720 UsbSnoop - IRP_MJ_POWER (IRP_MN_SET_POWER),
SystemContext 4D505950, DevicePowerState = PowerDeviceD2
00000141 27.35277280 UsbSnoop - IRP_MJ_POWER (IRP_MN_SET_POWER),
SystemContext 4D505950, DevicePowerState = PowerDeviceD0
00000142 27.45802640 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000143 27.45804000
*****
Now starts the protocol as described in the information I got from Mustek.
One can see shortly before that the devie gets power management messages.
*****
00000144 27.45804480 >>>>>>> URB 4 going down...
00000145 27.45805840 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000146 27.45807200   PipeHandle           = c15dbf2c
00000147 27.45809120   TransferFlags        = 00000002
(USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANSFER_OK)
00000148 27.45810320   TransferBufferLength = 0000000c
00000149 27.45811440   TransferBuffer       = 00000000
00000150 27.45812640   TransferBufferMDL    = c160c780
00000151 27.45814560
00000152 27.45814960     0000:
00000153 27.45820080  08 00 00 00 01 00 00 00 00 00 00 00
00000154 27.45821200   UrbLink              = 00000000
00000155 27.45963440
00000156 27.45963920 <<<<<<< URB 4 coming back...
00000157 27.45965360 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000158 27.45966720   PipeHandle           = c15dbf2c
00000159 27.45968640   TransferFlags        = 00000002
(USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANSFER_OK)
00000160 27.45969840   TransferBufferLength = 0000000c
00000161 27.45971040   TransferBuffer       = 00000000
00000162 27.45972320   TransferBufferMDL    = c160c780
00000163 27.45973520   UrbLink              = 00000000
00000164 70.02992720 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000165 70.02994160
00000166 70.02994640 >>>>>>> URB 5 going down...
00000167 70.02996080 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000168 70.02997360   PipeHandle           = c15dbf2c
00000169 70.02999360   TransferFlags        = 00000002
(USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANSFER_OK)
00000170 70.03000560   TransferBufferLength = 0000000c
00000171 70.03001680   TransferBuffer       = 00000000
00000172 70.03002880   TransferBufferMDL    = c160cc40
00000173 70.03004880
00000174 70.03005280     0000:
00000175 70.03010320  08 00 00 00 03 01 00 00 00 00 00 00
00000176 70.03011520   UrbLink              = 00000000
00000177 70.03193280
00000178 70.03193760 <<<<<<< URB 5 coming back...
00000179 70.03195200 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000180 70.03196480   PipeHandle           = c15dbf2c
00000181 70.03198480   TransferFlags        = 00000002
(USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANSFER_OK)
00000182 70.03199760   TransferBufferLength = 0000000c
00000183 70.03200960   TransferBuffer       = 00000000
00000184 70.03202320   TransferBufferMDL    = c160cc40
00000185 70.03203440   UrbLink              = 00000000
00000186 70.03213520 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000187 70.03214640
00000188 70.03215120 >>>>>>> URB 6 going down...
00000189 70.03216480 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000190 70.03217760   PipeHandle           = c15dbf40
00000191 70.03219680   TransferFlags        = 00000003
(USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
00000192 70.03220800   TransferBufferLength = 00000004
00000193 70.03222000   TransferBuffer       = 00000000
00000194 70.03223280   TransferBufferMDL    = c160cc40
00000195 70.03224480   UrbLink              = 00000000
00000196 70.54922000
00000197 70.54922560 <<<<<<< URB 6 coming back...
00000198 70.54924320 -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
00000199 70.54925760   PipeHandle           = c15dbf40
00000200 70.54927760   TransferFlags        = 00000003
(USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
00000201 70.54929120   TransferBufferLength = 00000004
00000202 70.54930240   TransferBuffer       = 00000000
00000203 70.54931600   TransferBufferMDL    = c160cc40
00000204 70.54932560
00000205 70.54933040     0000:
00000206 70.54935200  01 00 00 00
00000207 70.54936400   UrbLink              = 00000000
00000208 70.54963520 UsbSnoop - IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB
00000209 70.54964880
*****
And so on...
*****


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to