Caching service class updates during bootup.
PATCH 1/1 Caching service class updates during bootup.
From: Alok Barsode <[email protected]>
adapter->svc_cache is uses to cache service class updates during bluetoothd bringup. adapter->cache_enable flag is used to switchoff the cache, so any successive service class updates are directly written to the device.
--- src/adapter.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-)
src/adapter.c +12 -10
@@ -127,7 +127,9 @@ struct btd_adapter {gboolean off_requested;/* DEVDOWN ioctl was called */ -uint8_t svc_cache;/* For bluetoothd startup */ +uint8_t svc_cache;/* Service Class cache */ +gboolean cache_enable; +gint ref; };
@@ -1977,6 +1979,7 @@ static int adapter_up(struct btd_adapter *adapter) adapter->pairable_timeout =get_pairable_timeout (srcaddr); adapter->state =DISCOVER_TYPE_NONE ; adapter->mode =MODE_CONNECTABLE ; + adapter->cache_enable = TRUE; scan_mode =SCAN_PAGE ; powered = TRUE;
@@ -2042,9 +2045,6 @@ proceed: } -if (adapter->svc_cache) -adapter_update (adapter,0 ); -if (dev_down) { adapter_ops->stop (adapter->dev_id); adapter->off_requested = TRUE;
@@ -2264,12 +2264,17 @@ int adapter_update(struct btd_adapter *adapter, uint8_t new_svc)if (dev->ignore)return 0 ; -if (!adapter->up) { -if (new_svc) - adapter->svc_cache = new_svc; +if (new_svc ==0 ) { + adapter->cache_enable = FALSE; + goto done; + } + +if (adapter->cache_enable) { + adapter->svc_cache = new_svc;return 0 ; } +done:if (new_svc) svclass = new_svc;else
@@ -2297,9 +2302,6 @@ int adapter_set_class(struct btd_adapter *adapter, uint8_t *cls)struct hci_dev *dev = &adapter->dev;uint32_t class; -if (adapter->svc_cache) - adapter->svc_cache =0 ; -if (memcmp (dev->class, cls,3 ) ==0 )return 0 ;
Signature · 1 line
1.5.6.3