Home | History | Annotate | Download | only in fastbootd

Lines Matching defs:phandle

50     void (*execute)(struct protocol_handle *phandle, const char *arg);
62 void (*phandle)(struct protocol_handle *phandle, const char *arg))
69 cmd->execute = phandle;
102 int protocol_handle_download(struct protocol_handle *phandle, size_t len)
104 return transport_handle_download(phandle->transport_handle, len);
107 static ssize_t protocol_handle_write(struct protocol_handle *phandle,
110 return transport_handle_write(phandle->transport_handle, buffer, len);
113 static void fastboot_ack(struct protocol_handle *phandle, const char *code,
118 if (phandle->state != STATE_COMMAND)
125 phandle->state = STATE_COMPLETE;
127 protocol_handle_write(phandle, response, strlen(response));
130 void fastboot_fail(struct protocol_handle *phandle, const char *reason)
132 fastboot_ack(phandle, "FAIL", reason);
135 void fastboot_okay(struct protocol_handle *phandle, const char *info)
137 fastboot_ack(phandle, "OKAY", info);
140 void fastboot_data(struct protocol_handle *phandle, size_t len)
146 ret = protocol_handle_write(phandle, response, strlen(response));
151 void protocol_handle_command(struct protocol_handle *phandle, char *buffer)
160 phandle->state = STATE_COMMAND;
161 cmd->execute(phandle, buffer + cmd->prefix_len);
162 if (phandle->state == STATE_COMMAND)
163 fastboot_fail(phandle, "unknown reason");
167 fastboot_fail(phandle, "unknown command");
172 struct protocol_handle *phandle;
174 phandle = calloc(sizeof(struct protocol_handle), 1);
176 phandle->transport_handle = thandle;
177 phandle->state = STATE_OFFLINE;
178 phandle->download_fd = -1;
180 pthread_mutex_init(&phandle->lock, NULL);
182 return phandle;
185 int protocol_get_download(struct protocol_handle *phandle)
189 pthread_mutex_lock(&phandle->lock);
190 fd = phandle->download_fd;
191 phandle->download_fd = -1;
192 pthread_mutex_unlock(&phandle->lock);