hcitool: bug in printing names of class of device
Hi All,
In our company we've designed BT remote controller device. We set class of device to 0x5cc (Major class: Peripheral, Minor class: Combo keyboard/pointing device + Remote control). On Windows it is recognized correct (icon and description), but on Linux (bluez-utils 3.4) "hcitool
scan --class --flush" prints "Device class: Invalid (0x005cc)".
I've found that only devices with major class < 5 are recognized correctly. This is because is bug in hcitool.c in function cmd_scan():
if ((cls[1] & 0x1f) > sizeof(*major_classes))
^^^^^^^^^^^^^^^^^^
this is always sizeof(char**) and on 32bit machine is 4! It should be:
sizeof(major_classes) / sizeof(char*),
Best regards,
Signature · 13 lines
Artur Wodejko [email protected] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Artur,
Quoted 6 lines
In our company we've designed BT remote controller device. We set class of device to
0x5cc(Major class: Peripheral, Minor class: Combo keyboard/pointing device + Remote control). On Windows it is recognized correct (icon and description), but on Linux (bluez-utils 3.4) "hcitool
scan --class --flush" prints "Device class: Invalid (0x005cc)".
Quoted 8 lines
I've found that only devices with major class < 5 are recognized correctly. This is because is bug in
hcitool.cin functioncmd_scan():if ((cls[1] &
0x1f) >sizeof(*major_classes))^^^^^^^^^^^^^^^^^^this is always
sizeof(char**)and on 32bit machine is 4! It should be:
sizeof(major_classes)/sizeof(char*),
thanks for looking into this. This is has been fixed in the CVS now.
Regards
Marcel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel