Skip to content

Commit

Permalink
LibUSBDB: Fix vendor id decoding
Browse files Browse the repository at this point in the history
This was broken because the whole line was being passed in instead
of a substring..
  • Loading branch information
Quaker762 authored and alimpfard committed Jun 18, 2021
1 parent 94f56b5 commit 906d3e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibUSBDB/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ int Database::init()
if (line[0] != '\t') {
commit_vendor();
current_vendor = make<Vendor>();
current_vendor->id = AK::StringUtils::convert_to_uint_from_hex<u16>(line).value_or(0);
current_vendor->id = AK::StringUtils::convert_to_uint_from_hex<u16>(line.substring_view(0, 4)).value_or(0);
current_vendor->name = line.substring_view(6, line.length() - 6);
} else if (line[0] == '\t' && line[1] != '\t') {
commit_device();
current_device = make<Device>();
current_device->id = AK::StringUtils::convert_to_uint_from_hex<u16>((line.substring_view(1, line.length() - 1))).value_or(0);
current_device->id = AK::StringUtils::convert_to_uint_from_hex<u16>((line.substring_view(1, 4))).value_or(0);
current_device->name = line.substring_view(7, line.length() - 7);
} else if (line[0] == '\t' && line[1] == '\t') {
auto interface = make<Interface>();
Expand Down

0 comments on commit 906d3e9

Please sign in to comment.