以往用AT89C55+CH375驱动EPSON打印机,现改用HP-1022激光打印机后,传数据到打印机的速度特慢,大约只有600字节每秒,而数据是正确的,因为等十几分钟后就可以打印出东西来。改用三星的1610后,数据传送速度是基本正常的,不知HP的怎么会不行?? (好象1610是USB1。1的,而HP-1022是USB2。0的,但CH375是两种都支持的)
你可以不可以将HP-1022的描述符贴出来看下撒
Device Descriptor: bcdUSB: 0x0200 bDeviceClass: 0x00 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x40 (64) idVendor: 0x03F0 (Hewlett Packard) idProduct: 0x2C17 bcdDevice: 0x0100 iManufacturer: 0x01 0x0409: "Hewlett-Packard" iProduct: 0x02 0x0409: "HP LaserJet 1022" iSerialNumber: 0x03 0x0409: "FL02R56" bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected Current Config Value: 0x01 Device Bus Speed: Full Device Address: 0x01 Open Pipes: 2
Endpoint Descriptor: bEndpointAddress: 0x01 Transfer Type: Bulk wMaxPacketSize: 0x0200 (512) bInterval: 0x00
Endpoint Descriptor: bEndpointAddress: 0x81 Transfer Type: Bulk wMaxPacketSize: 0x0200 (512) bInterval: 0x00
Configuration Descriptor: wTotalLength: 0x0020 bNumInterfaces: 0x01 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0xC0 (Bus Powered Self Powered ) MaxPower: 0x31 (98 Ma)
Interface Descriptor: bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x02 bInterfaceClass: 0x07 bInterfaceSubClass: 0x01 bInterfaceProtocol: 0x02 iInterface: 0x00
首先,你的单片机获取到了描述符,你在你的枚举初始化里要进行处理
同时,你还要将wMaxPacketSize修改为64
wMaxPacketSize 和端点地址怎么改在CH375上用什么命令?有没有SET_Descriptor这条的? 三星的的确有点不同, Device Descriptor: bcdUSB: 0x0110 bDeviceClass: 0x00 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x10 (16) idVendor: 0x04E8 idProduct: 0x3268 bcdDevice: 0x0100 iManufacturer: 0x01 0x0409: "Samsung Electronics Co., Ltd." iProduct: 0x02 0x0409: "Samsung ML-1610 Series" iSerialNumber: 0x03 0x0409: "3940BKAL219578Z." bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected Current Config Value: 0x01 Device Bus Speed: Full Device Address: 0x01 Open Pipes: 2
Endpoint Descriptor: bEndpointAddress: 0x03 Transfer Type: Bulk wMaxPacketSize: 0x0040 (64) bInterval: 0x00
Endpoint Descriptor: bEndpointAddress: 0x81 Transfer Type: Bulk wMaxPacketSize: 0x0040 (64) bInterval: 0x00
Configuration Descriptor: wTotalLength: 0x0020 bNumInterfaces: 0x01 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0xC0 (Bus Powered Self Powered ) MaxPower: 0x01 (2 Ma)
Interface Descriptor: bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x02 bInterfaceClass: 0x07 bInterfaceSubClass: 0x01 bInterfaceProtocol: 0x02 iInterface: 0x00
不是的
usbxf 听另一个大哥说把包改为64,如果设备能允许修改的话(用Set_Descriptor),问题是否能解决?
你可以发送该请求试试,大部分的USB设备都不支持该请求.我想这台打印机也不可能支持,因为如果支持设置描述符的话,它不如在设备描述符中告诉支持多个配置了,那样我们选择最大64字节的数据包的配置就可以了.
h还有一个问题你在使用该2.0打印机时使用的是不是64字节的包长度传输的啊?? 会不会在设置最大包长度上有问题啊??比如说你将长度设置为2字节.这时的速度就会慢的可怜了.
是64的,我用BUS Hound来抓了一次,帮忙看一下有没有其它配置?
31.0 CTL 00 09 00 00 00 00 00 00 SET CONFIG 1.1.0 31.0 USTS 00 70 00 c0 no device 1.2.0 31.0 CTL 80 06 00 02 00 00 09 01 GET DESCRIPTOR 2.1.0 31.0 DI 09 02 20 00 01 01 00 c0 .. ..... 2.2.0 31 09 04 00 00 02 07 01 1....... 2.2.8 02 00 07 05 01 02 00 02 ........ 2.2.16 00 07 05 81 02 00 02 00 ........ 2.2.24 31.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 3.1.0 31.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 4.1.0 31.0 DI 12 01 00 02 00 00 00 40 .......@ 4.2.0 f0 03 17 2c 00 01 01 02 ...,.... 4.2.8 03 01 .. 4.2.16 31.0 CTL a1 00 00 00 00 00 f1 03 GET DEVICE ID 5.1.0 31.0 DI 00 63 4d 46 47 3a 48 65 .cMFG:He 5.2.0 77 6c 65 74 74 2d 50 61 wlett-Pa 5.2.8 63 6b 61 72 64 3b 4d 44 ckard;MD 5.2.16 4c 3a 48 50 20 4c 61 73 L:HP Las 5.2.24 65 72 4a 65 74 20 31 30 erJet 10 5.2.32 32 32 3b 43 4d 44 3a 41 22;CMD:A 5.2.40 43 4c 3b 43 4c 53 3a 50 CL;CLS:P 5.2.48 52 49 4e 54 45 52 3b 44 RINTER;D 5.2.56 45 53 3a 48 50 20 4c 61 ES:HP La 5.2.64 73 65 72 4a 65 74 20 31 serJet 1 5.2.72 30 32 32 3b 46 57 56 45 022;FWVE 5.2.80 52 3a 32 30 30 35 30 32 R:200502 5.2.88 31 37 3b 17; 5.2.96
好象没有.
你的配置值就一个,就是在设备描述符的最后一位就是配置描述符的数目
Device Phase Data Description Cmd.Phase.Ofs(rep) ------ ----- ------------------------ ---------------- ------------------ 31.0 CTL 00 07 05 01 00 00 07 00 SET DESCRIPTOR 1.1.0 31.0 USTS 04 00 00 c0 stall pid 1.2.0 31.0 CTL 00 07 05 01 00 00 00 00 SET DESCRIPTOR 2.1.0 31.0 USTS 04 00 00 c0 stall pid 2.2.0 我尝试上面的,是不是证明设备不允许改?或者命令不对?