Changeset 954ea70 in mainline
- Timestamp:
- 2010-10-22T14:55:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8a3cda
- Parents:
- a498728
- Location:
- uspace/lib/usbvirt
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/ctrlpipe.c
ra498728 r954ea70 45 45 ((value & GET_MIDBITS_MASK(size, shift)) >> shift) 46 46 47 usb_address_t dev_new_address = -1; 48 47 49 static int request_get_type(uint8_t request_type) 48 50 { … … 63 65 int type = request_get_type(request->request_type); 64 66 67 int rc = EOK; 68 65 69 switch (type) { 66 70 case REQUEST_TYPE_STANDARD: 67 r eturnhandle_std_request(request, remaining_data);71 rc = handle_std_request(request, remaining_data); 68 72 break; 69 73 case REQUEST_TYPE_CLASS: 70 74 if (DEVICE_HAS_OP(device, on_class_device_request)) { 71 r eturndevice->ops->on_class_device_request(device,75 rc = device->ops->on_class_device_request(device, 72 76 request, remaining_data); 73 77 } … … 77 81 } 78 82 79 return EOK; 83 device->send_data(device, 0, NULL, 0); 84 85 if (dev_new_address != -1) { 86 /* 87 * TODO: handle when this request is invalid (e.g. 88 * setting address when in configured state). 89 */ 90 if (dev_new_address == 0) { 91 device->state = USBVIRT_STATE_DEFAULT; 92 } else { 93 device->state = USBVIRT_STATE_ADDRESS; 94 } 95 device->address = dev_new_address; 96 97 dev_new_address = -1; 98 } 99 100 return rc; 80 101 } 81 102 -
uspace/lib/usbvirt/ids.h
ra498728 r954ea70 44 44 int usbvirt_disconnect(void); 45 45 46 typedef enum { 47 USBVIRT_TRANSACTION_SETUP, 48 USBVIRT_TRANSACTION_IN, 49 USBVIRT_TRANSACTION_OUT 50 } usbvirt_transaction_type_t; 51 52 46 53 #endif 47 54 /** -
uspace/lib/usbvirt/main.c
ra498728 r954ea70 122 122 return EINVAL; 123 123 } 124 if ((buffer == NULL) || (size == 0)) {124 if ((buffer == NULL) && (size != 0)) { 125 125 return EINVAL; 126 126 } … … 131 131 int rc; 132 132 133 req = async_send_ 2(phone,133 req = async_send_3(phone, 134 134 IPC_M_USBVIRT_DATA_FROM_DEVICE, 135 135 dev->address, 136 136 endpoint, 137 size, 137 138 &answer_data); 138 139 139 rc = async_data_write_start(phone, buffer, size); 140 if (rc != EOK) { 141 async_wait_for(req, NULL); 142 return rc; 140 if (size > 0) { 141 rc = async_data_write_start(phone, buffer, size); 142 if (rc != EOK) { 143 async_wait_for(req, NULL); 144 return rc; 145 } 143 146 } 144 147 -
uspace/lib/usbvirt/private.h
ra498728 r954ea70 58 58 int handle_std_request(usb_device_request_setup_packet_t *request, uint8_t *data); 59 59 60 extern usb_address_t dev_new_address; 61 60 62 #endif 61 63 /** -
uspace/lib/usbvirt/stdreq.c
ra498728 r954ea70 117 117 } 118 118 119 /* 120 * TODO: handle when this request is invalid (e.g. 121 * setting address when in configured state). 122 */ 123 if (new_address == 0) { 124 device->state = USBVIRT_STATE_DEFAULT; 125 } else { 126 device->state = USBVIRT_STATE_ADDRESS; 127 } 128 129 device->address = new_address; 119 dev_new_address = new_address; 130 120 131 121 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.