configuring device class
PATCH 1/1 configuring device class
Hi.
I am investigating ways to set the device class (computer/laptop etc) of a bluetooth device. There is a key in main.conf named Class to set the class but aparently it is overridden by the class field of /var/lib/bluetooth/<bdaddr>/config. Once the class is stored there changes in main.conf don't affect the actual class the device presents. IMHO it is quite obutse and it took me an hour or more with a debugger to find out how to change it so I'd like to propose the following patch. Are there any reasons that the config file in /var should override the value from /etc?
src/adapter.c +5 -3
@@ -2261,6 +2261,7 @@ void btd_adapter_start(struct btd_adapter *adapter) {char address[18 ];uint8_t cls[3 ]; +uint32_t class;gboolean powered;ba2str (&adapter->bdaddr, address);
@@ -2279,10 +2280,11 @@ void btd_adapter_start(struct btd_adapter *adapter) adapter_ops->set_name (adapter->dev_id, adapter->name); -if (read_local_class (&adapter->bdaddr, cls) <0 ) { -uint32_t class =htobl (main_opts.class); + class =htobl (main_opts.class); +if (class !=0 )memcpy (cls, &class,3 ); - } +else +read_local_class (&adapter->bdaddr, cls);btd_adapter_set_class (adapter, cls[1 ], cls[0 ]);
Signature · 1 line
Było mi bardzo miło. Czwarta pospolita klęska, [...]
Quoted 1 line
Łukasz< Już nie katolicka lecz złodziejska. (c)PP
----------------------------------------------------------------
Znajdz samochod idealny dla siebie!
Szukaj >> http://linkint.pl/f29e2
Quoted 11 lines · Lukasz Stelmach
Hi.
I am investigating ways to set the device class (computer/laptop etc) of a bluetooth device. There is a key in main.conf named Class to set the class but aparently it is overridden by the class field of /var/lib/bluetooth/<bdaddr>/config. Once the class is stored there changes in main.conf don't affect the actual class the device presents. IMHO it is quite obutse and it took me an hour or more with a debugger to find out how to change it so I'd like to propose the following patch. Are there any reasons that the config file in /var should override the value from /etc?
I'm not sure what we're trying to achieve with per-adapter classes (if not for debugging purposes).
I would simply never write the class of the adapter to disk, and use the DMI information, with the value in the options file as fallback if a class could not be gathered. If the formfactor plugin isn't in use, use the options value.
eg. your patch, plus a change in formfactor.c to not overwrite the class, and another to never actually write the class to disk.
Cheers