Changeset 7787dd81 in mainline
- Timestamp:
- 2011-04-01T13:57:12Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e4153ea
- Parents:
- 85fa1e1 (diff), 70a71e5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/kbddev.c
r85fa1e1 r7787dd81 272 272 unsigned i = 0; 273 273 274 /* Reset the LED data. */ 275 memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t)); 276 274 277 if ((kbd_dev->mods & KM_NUM_LOCK) && (i < kbd_dev->led_output_size)) { 275 278 kbd_dev->led_data[i++] = USB_HID_LED_NUM_LOCK; -
uspace/lib/usb/src/hidparser.c
r85fa1e1 r7787dd81 1200 1200 } 1201 1201 1202 usb_log_debug("OUTPUT BUFFER: %s\n", usb_debug_str_buffer(buffer,size, 0)); 1203 usb_log_debug("OUTPUT DATA[0]: %d, DATA[1]: %d, DATA[2]: %d\n", data[0], data[1], data[2]); 1204 1202 1205 item = parser->output.next; 1203 1206 while(item != &parser->output) { … … 1208 1211 if(idx >= data_size) { 1209 1212 break; 1210 }1211 1212 // translate data1213 if(USB_HID_ITEM_FLAG_CONSTANT(report_item->item_flags)) {1214 value = report_item->logical_minimum;1215 }1216 else {1217 //variable item1218 value = usb_hid_translate_data_reverse(report_item, data[idx]);1219 idx++;1220 1213 } 1221 1214 … … 1224 1217 1225 1218 // // variable item 1219 value = usb_hid_translate_data_reverse(report_item, data[idx++]); 1226 1220 offset = report_item->offset + (i * report_item->size); 1227 1221 length = report_item->size; … … 1229 1223 else { 1230 1224 //bitmap 1225 value += usb_hid_translate_data_reverse(report_item, data[idx++]); 1231 1226 offset = report_item->offset; 1232 1227 length = report_item->size * report_item->count; … … 1239 1234 } 1240 1235 1241 size_t shift=0; 1242 if(((offset+length)%8) > 0) { 1243 shift = (8- ((offset+length)%8)); 1244 } 1236 size_t shift = offset%8; 1245 1237 1246 1238 value = value << shift; 1247 1239 value = value & (((1 << length)-1) << shift); 1248 buffer[offset/8] = buffer[offset/8] | value; 1240 1241 uint8_t mask = 0; 1242 mask = 0xff - (((1 << length) - 1) << shift); 1243 buffer[offset/8] = (buffer[offset/8] & mask) | value; 1249 1244 } 1250 1245 else { 1251 1246 // je to ve dvou!! FIXME: melo by to umet delsi jak 2 1252 1247 1253 // konec prvniho 1248 // konec prvniho -- dolni x bitu 1254 1249 tmp_value = value; 1255 tmp_value = tmp_value >> (8 - (offset%8) - 1);1256 1250 tmp_value = tmp_value & ((1 << (8-(offset%8)))-1); 1257 1258 buffer[offset/8] = buffer[offset/8] | tmp_value; 1259 1260 // a ted druhej 1261 value = value & ((1 << (length - (8 - (offset%8))))-1); 1262 value = value << (8 - (length - (8 - (offset%8)))); 1251 tmp_value = tmp_value << (offset%8); 1252 1253 uint8_t mask = 0; 1254 mask = ~(((1 << (8-(offset%8)))-1) << (offset%8)); 1255 buffer[offset/8] = (buffer[offset/8] & mask) | tmp_value; 1256 1257 // a ted druhej -- hornich length-x bitu 1258 value = value >> (8 - (offset % 8)); 1259 value = value & ((1 << (length - (8 - (offset % 8)))) - 1); 1263 1260 1264 buffer[(offset+length-1)/8] = buffer[(offset+length-1)/8] | value; 1261 mask = ((1 << (length - (8 - (offset % 8)))) - 1); 1262 buffer[(offset+length-1)/8] = (buffer[(offset+length-1)/8] & mask) | value; 1265 1263 } 1266 1264 … … 1270 1268 } 1271 1269 1270 usb_log_debug("OUTPUT BUFFER: %s\n", usb_debug_str_buffer(buffer,size, 0)); 1272 1271 1273 1272 return EOK; … … 1284 1283 int ret=0; 1285 1284 int resolution; 1285 1286 if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags)) { 1287 ret = item->logical_minimum; 1288 } 1286 1289 1287 1290 if((USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0)) {
Note:
See TracChangeset
for help on using the changeset viewer.