diff options
| author | 2010-05-24 18:00:50 +0200 | |
|---|---|---|
| committer | 2010-05-26 01:39:28 +0200 | |
| commit | 847eaeba69de3b22e5d65b3a98311655876df80e (patch) | |
| tree | 7b54addfcedb6c9bbe0c53d3648984c5ed01dc61 | |
| parent | dab29e73450ca82d6de991db529d39f7d89dd1e8 (diff) | |
| download | usbmuxd-847eaeba69de3b22e5d65b3a98311655876df80e.tar.gz usbmuxd-847eaeba69de3b22e5d65b3a98311655876df80e.tar.bz2 | |
usbmuxd: rename notify_device to notify_device_add; added notify_device_remove
| -rw-r--r-- | daemon/client.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/daemon/client.c b/daemon/client.c index 4f44bcc..194632d 100644 --- a/daemon/client.c +++ b/daemon/client.c | |||
| @@ -201,7 +201,7 @@ int client_notify_connect(struct mux_client *client, enum usbmuxd_result result) | |||
| 201 | return 0; | 201 | return 0; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static int notify_device(struct mux_client *client, struct device_info *dev) | 204 | static int notify_device_add(struct mux_client *client, struct device_info *dev) |
| 205 | { | 205 | { |
| 206 | struct usbmuxd_device_record dmsg; | 206 | struct usbmuxd_device_record dmsg; |
| 207 | memset(&dmsg, 0, sizeof(dmsg)); | 207 | memset(&dmsg, 0, sizeof(dmsg)); |
| @@ -213,6 +213,11 @@ static int notify_device(struct mux_client *client, struct device_info *dev) | |||
| 213 | return send_pkt(client, 0, MESSAGE_DEVICE_ADD, &dmsg, sizeof(dmsg)); | 213 | return send_pkt(client, 0, MESSAGE_DEVICE_ADD, &dmsg, sizeof(dmsg)); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static int notify_device_remove(struct mux_client *client, uint32_t device_id) | ||
| 217 | { | ||
| 218 | return send_pkt(client, 0, MESSAGE_DEVICE_REMOVE, &device_id, sizeof(uint32_t)); | ||
| 219 | } | ||
| 220 | |||
| 216 | static int start_listen(struct mux_client *client) | 221 | static int start_listen(struct mux_client *client) |
| 217 | { | 222 | { |
| 218 | struct device_info *devs; | 223 | struct device_info *devs; |
| @@ -235,7 +240,7 @@ static int start_listen(struct mux_client *client) | |||
| 235 | } | 240 | } |
| 236 | dev = devs; | 241 | dev = devs; |
| 237 | for(i=0; i<count; i++) { | 242 | for(i=0; i<count; i++) { |
| 238 | if(notify_device(client, dev++) < 0) { | 243 | if(notify_device_add(client, dev++) < 0) { |
| 239 | free(devs); | 244 | free(devs); |
| 240 | return -1; | 245 | return -1; |
| 241 | } | 246 | } |
| @@ -402,7 +407,7 @@ void client_device_add(struct device_info *dev) | |||
| 402 | usbmuxd_log(LL_DEBUG, "client_device_add: id %d, location 0x%x, serial %s", dev->id, dev->location, dev->serial); | 407 | usbmuxd_log(LL_DEBUG, "client_device_add: id %d, location 0x%x, serial %s", dev->id, dev->location, dev->serial); |
| 403 | FOREACH(struct mux_client *client, &client_list) { | 408 | FOREACH(struct mux_client *client, &client_list) { |
| 404 | if(client->state == CLIENT_LISTEN) | 409 | if(client->state == CLIENT_LISTEN) |
| 405 | notify_device(client, dev); | 410 | notify_device_add(client, dev); |
| 406 | } ENDFOREACH | 411 | } ENDFOREACH |
| 407 | } | 412 | } |
| 408 | void client_device_remove(int device_id) | 413 | void client_device_remove(int device_id) |
| @@ -411,7 +416,7 @@ void client_device_remove(int device_id) | |||
| 411 | usbmuxd_log(LL_DEBUG, "client_device_remove: id %d", device_id); | 416 | usbmuxd_log(LL_DEBUG, "client_device_remove: id %d", device_id); |
| 412 | FOREACH(struct mux_client *client, &client_list) { | 417 | FOREACH(struct mux_client *client, &client_list) { |
| 413 | if(client->state == CLIENT_LISTEN) | 418 | if(client->state == CLIENT_LISTEN) |
| 414 | send_pkt(client, 0, MESSAGE_DEVICE_REMOVE, &id, sizeof(uint32_t)); | 419 | notify_device_remove(client, id); |
| 415 | } ENDFOREACH | 420 | } ENDFOREACH |
| 416 | } | 421 | } |
| 417 | 422 | ||
