Changeset 1433ecda in mainline for uspace/srv/hid/isdv4_tablet
- Timestamp:
- 2018-04-04T15:42:37Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- Location:
- uspace/srv/hid/isdv4_tablet
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/isdv4_tablet/isdv4.c
r47b2d7e3 r1433ecda 98 98 event.button = 1; 99 99 state->emit_event_fn(&event); 100 } 101 else if (finger1 && !state->finger1_pressed) { 100 } else if (finger1 && !state->finger1_pressed) { 102 101 state->finger1_pressed = true; 103 102 … … 105 104 event.button = 1; 106 105 state->emit_event_fn(&event); 107 } 108 else { 106 } else { 109 107 event.type = MOVE; 110 108 event.button = 1; … … 112 110 } 113 111 } 114 } 115 else { 112 } else { 116 113 if (size != 9) 117 114 return true; … … 133 130 event.type = PROXIMITY_IN; 134 131 state->emit_event_fn(&event); 135 } 136 else if (!proximity && state->stylus_in_proximity) { 132 } else if (!proximity && state->stylus_in_proximity) { 137 133 /* Stylus came out of proximity */ 138 134 state->stylus_in_proximity = false; … … 140 136 event.type = PROXIMITY_OUT; 141 137 state->emit_event_fn(&event); 142 } 143 else { 138 } else { 144 139 /* Proximity state didn't change, but we need to check if it is still eraser */ 145 140 if (state->stylus_is_eraser && !button2) { … … 151 146 state->emit_event_fn(&event); 152 147 state->stylus_is_eraser = false; 153 } 154 else if (!state->stylus_is_eraser && !tip && button2) { 148 } else if (!state->stylus_is_eraser && !tip && button2) { 155 149 event.type = PROXIMITY_OUT; 156 150 event.source = STYLUS_TIP; … … 170 164 event.button = 1; 171 165 state->emit_event_fn(&event); 172 } 173 else if (!tip && state->tip_pressed) { 166 } else if (!tip && state->tip_pressed) { 174 167 state->tip_pressed = false; 175 168 event.type = RELEASE; … … 184 177 event.button = 2; 185 178 state->emit_event_fn(&event); 186 } 187 else if (!button1 && state->button1_pressed) { 179 } else if (!button1 && state->button1_pressed) { 188 180 state->button1_pressed = false; 189 181 event.type = RELEASE; … … 198 190 event.button = 3; 199 191 state->emit_event_fn(&event); 200 } 201 else if (!button2 && state->button2_pressed) { 192 } else if (!button2 && state->button2_pressed) { 202 193 state->button2_pressed = false; 203 194 event.type = RELEASE; … … 210 201 event.button = 0; 211 202 state->emit_event_fn(&event); 212 } 213 else { 203 } else { 214 204 if (tip && !state->tip_pressed) { 215 205 state->tip_pressed = true; … … 218 208 event.button = 1; 219 209 state->emit_event_fn(&event); 220 } 221 else if (!tip && state->tip_pressed) { 210 } else if (!tip && state->tip_pressed) { 222 211 state->tip_pressed = false; 223 212 event.type = RELEASE; … … 310 299 311 300 /* Skip data until a start of packet is found */ 312 while (i < state->buf_end && (state->buf[i] & START_OF_PACKET) == 0) i++; 301 while (i < state->buf_end && (state->buf[i] & START_OF_PACKET) == 0) 302 i++; 313 303 314 304 size_t start = i; … … 322 312 if (state->buf[i] & CONTROL_PACKET) { 323 313 packet_remaining = 11; 324 } 325 else if (state->buf[i] & TOUCH_EVENT) { 314 } else if (state->buf[i] & TOUCH_EVENT) { 326 315 packet_remaining = 5; 327 } 328 else { 316 } else { 329 317 packet_remaining = 9; 330 318 } -
uspace/srv/hid/isdv4_tablet/main.c
r47b2d7e3 r1433ecda 94 94 fibril_mutex_unlock(&client_mutex); 95 95 96 if (!sess) return; 96 if (!sess) 97 return; 97 98 98 99 async_exch_t *exch = async_exchange_begin(sess); … … 105 106 } 106 107 async_msg_4(exch, MOUSEEV_ABS_MOVE_EVENT, event->x, event->y, 107 max_x, max_y);108 max_x, max_y); 108 109 if (event->type == PRESS || event->type == RELEASE) { 109 110 async_msg_2(exch, MOUSEEV_BUTTON_EVENT, event->button, 110 event->type == PRESS);111 event->type == PRESS); 111 112 } 112 113 } … … 118 119 const char *type = NULL; 119 120 switch (event->type) { 120 case PRESS:121 type = "PRESS";122 break;123 case RELEASE:124 type = "RELEASE";125 break;126 case PROXIMITY_IN:127 type = "PROXIMITY IN";128 break;129 case PROXIMITY_OUT:130 type = "PROXIMITY OUT";131 break;132 case MOVE:133 type = "MOVE";134 break;135 default:136 type = "UNKNOWN";137 break;121 case PRESS: 122 type = "PRESS"; 123 break; 124 case RELEASE: 125 type = "RELEASE"; 126 break; 127 case PROXIMITY_IN: 128 type = "PROXIMITY IN"; 129 break; 130 case PROXIMITY_OUT: 131 type = "PROXIMITY OUT"; 132 break; 133 case MOVE: 134 type = "MOVE"; 135 break; 136 default: 137 type = "UNKNOWN"; 138 break; 138 139 } 139 140 140 141 const char *source = NULL; 141 142 switch (event->source) { 142 case STYLUS_TIP:143 source = "stylus tip";144 break;145 case STYLUS_ERASER:146 source = "stylus eraser";147 break;148 case TOUCH:149 source = "touch";150 break;143 case STYLUS_TIP: 144 source = "stylus tip"; 145 break; 146 case STYLUS_ERASER: 147 source = "stylus eraser"; 148 break; 149 case TOUCH: 150 source = "touch"; 151 break; 151 152 } 152 153 … … 160 161 { 161 162 switch (data_id) { 162 case 0:163 return "resistive+stylus";164 case 1:165 return "capacitive+stylus";166 case 2:167 return "resistive";168 case 3:169 case 4:170 return "capacitive";171 case 5:172 return "penabled";163 case 0: 164 return "resistive+stylus"; 165 case 1: 166 return "capacitive+stylus"; 167 case 2: 168 return "resistive"; 169 case 3: 170 case 4: 171 return "capacitive"; 172 case 5: 173 return "penabled"; 173 174 } 174 175 return "unknown"; … … 189 190 if (argc > arg && str_test_prefix(argv[arg], "--baud=")) { 190 191 size_t arg_offset = str_lsize(argv[arg], 7); 191 char *arg_str = argv[arg] + arg_offset;192 char *arg_str = argv[arg] + arg_offset; 192 193 if (str_length(arg_str) == 0) { 193 194 fprintf(stderr, "--baud requires an argument\n"); … … 219 220 } 220 221 arg++; 221 } 222 else { 222 } else { 223 223 category_id_t serial_cat_id; 224 224 … … 233 233 size_t svc_count; 234 234 235 rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count); if (rc != EOK) { 235 rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count); 236 if (rc != EOK) { 236 237 fprintf(stderr, "Failed getting list of services\n"); 237 238 return 1; … … 301 302 if (state.stylus_tilt_supported) { 302 303 printf("%ux%u\n", state.stylus_max_xtilt, state.stylus_max_ytilt); 303 } 304 else { 304 } else { 305 305 printf("not supported\n"); 306 306 } 307 307 printf(" Touch: %ux%u type: %s\n", state.touch_max_x, state.touch_max_y, 308 touch_type(state.touch_type));308 touch_type(state.touch_type)); 309 309 310 310 fid_t fibril = fibril_create(read_fibril, NULL); … … 337 337 if (rc != EOK) { 338 338 printf(NAME ": Unable to get mouse category id.\n"); 339 } 340 else { 339 } else { 341 340 rc = loc_service_add_to_cat(service_id, mouse_category); 342 341 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
