mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-16 06:46:59 +00:00
- DFU and RNDIS fixes
This commit is contained in:
commit
573359d14d
3 changed files with 11 additions and 8 deletions
|
@ -325,7 +325,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
|
|||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
if (!(ctrl->bRequestType & USB_DIR_IN)) {
|
||||
if (len == 0) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuERROR;
|
||||
value = RET_STALL;
|
||||
|
@ -337,7 +337,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
|
|||
}
|
||||
break;
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
if (ctrl->bRequestType & USB_DIR_IN) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
|
||||
f_dfu->blk_seq_num = 0;
|
||||
value = handle_upload(req, len);
|
||||
|
@ -436,7 +436,7 @@ static int state_dfu_dnload_idle(struct f_dfu *f_dfu,
|
|||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
if (!(ctrl->bRequestType & USB_DIR_IN)) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
f_dfu->blk_seq_num = w_value;
|
||||
value = handle_dnload(gadget, len);
|
||||
|
@ -527,7 +527,7 @@ static int state_dfu_upload_idle(struct f_dfu *f_dfu,
|
|||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
if (ctrl->bRequestType & USB_DIR_IN) {
|
||||
/* state transition if less data then requested */
|
||||
f_dfu->blk_seq_num = w_value;
|
||||
value = handle_upload(req, len);
|
||||
|
|
|
@ -855,14 +855,17 @@ static int rndis_set_response(int configNr, rndis_set_msg_type *buf)
|
|||
rndis_set_cmplt_type *resp;
|
||||
rndis_resp_t *r;
|
||||
|
||||
BufLength = get_unaligned_le32(&buf->InformationBufferLength);
|
||||
BufOffset = get_unaligned_le32(&buf->InformationBufferOffset);
|
||||
if ((BufOffset > RNDIS_MAX_TOTAL_SIZE - 8) ||
|
||||
(BufLength > RNDIS_MAX_TOTAL_SIZE - 8 - BufOffset))
|
||||
return -EINVAL;
|
||||
|
||||
r = rndis_add_response(configNr, sizeof(rndis_set_cmplt_type));
|
||||
if (!r)
|
||||
return -ENOMEM;
|
||||
resp = (rndis_set_cmplt_type *) r->buf;
|
||||
|
||||
BufLength = get_unaligned_le32(&buf->InformationBufferLength);
|
||||
BufOffset = get_unaligned_le32(&buf->InformationBufferOffset);
|
||||
|
||||
#ifdef VERBOSE
|
||||
debug("%s: Length: %d\n", __func__, BufLength);
|
||||
debug("%s: Offset: %d\n", __func__, BufOffset);
|
||||
|
|
|
@ -495,7 +495,7 @@ static inline int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DFU_VIRT
|
||||
#if CONFIG_IS_ENABLED(DFU_VIRT)
|
||||
int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr,
|
||||
char **argv, int argc);
|
||||
int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
|
||||
|
|
Loading…
Add table
Reference in a new issue