usbatm cxacru.c,1.17,1.18 usbatm.c,1.14,1.15
Duncan Sands
baldrick at free.fr
Fri Mar 4 06:51:51 EST 2005
Are you sure this is correct? Consider idVendor (16 bits),
and for simplicity let's forget about idProduct.
idVendor arrived from the device in a bunch of bytes:
|byte| ... |byte| |V1| |V2| ...
where V1 and V2 are the two bytes somehow making up idVendor.
It should be sent to the device exactly the same:
|byte'| ... |byte'| |V1| |V2| ...
idVendor contains these same bytes somewhere in memory (same order):
... |V1| |V2| ...
^^^^^^^^^
idVendor
Now you want to send those bytes to the device. So you should call
cxacru_fw with data pointing to those bytes:
data
|
|
... |V1| |V2| ...
^^^^^^^^^
idVendor
Then they will be sent to the modem as a stream of bytes
|V1| |V2| ...
which is what you want. So... what are you doing a le16_to_cpu for?
> - const u32 vid = usb_dev->descriptor.idVendor;
> - const u32 pid = usb_dev->descriptor.idProduct;
> + u32 signature = le16_to_cpu(usb_dev->descriptor.idVendor) |
> + (le16_to_cpu(usb_dev->descriptor.idProduct) << 16);
> u32 val;
>
> dbg("cxacru_upload_firmware");
> @@ -563,8 +563,7 @@
> }
>
> /* Signature */
> - val = (pid << 16) | (vid & 0xffff);
> - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) &val, 4);
> + ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) &signature, 4);
All the best,
Duncan.
More information about the Usbatm
mailing list