monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS
Luiz Augusto von Dentz
maintainerPATCH 1/3 monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS
From: Luiz Augusto von Dentz <[email protected]>
The fields of BT_HCI_CMD_LE_SET_CIG_PARAMS are bitfields rather than values, so this changes the fields to phy's' and fixes the parsing to print it as bitfield rather than value.
--- emulator/btdev.c | 4 ++-- emulator/bthost.c | 4 ++-- monitor/bt.h | 12 ++++++------ monitor/ll.c | 8 ++++---- monitor/packet.c | 18 +++++++++--------- 5 files changed, 23 insertions(+), 23 deletions(-)
emulator/btdev.c +2 -2
@@ -6977,8 +6977,8 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,memset (evt.cig_sync_delay,0 ,sizeof (evt.cig_sync_delay));memset (evt.cis_sync_delay,0 ,sizeof (evt.cis_sync_delay)); - evt.c_phy = le_cig->cis[cis_idx].c_phy; - evt.p_phy = le_cig->cis[cis_idx].p_phy; + evt.c_phy = le_cig->cis[cis_idx].c_phys; + evt.p_phy = le_cig->cis[cis_idx].p_phys; evt.nse =0x01 ; evt.c_bn =0x01 ; evt.p_bn =0x01 ;
emulator/bthost.c +2 -2
@@ -3886,9 +3886,9 @@ void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id, cp->cis[0 ].cis_id = cis_id; cp->cis[0 ].c_sdu = qos->ucast.in.sdu; cp->cis[0 ].p_sdu = qos->ucast.out.sdu; - cp->cis[0 ].c_phy = qos->ucast.in.phy ? qos->ucast.in.phy : + cp->cis[0 ].c_phys = qos->ucast.in.phy ? qos->ucast.in.phy : qos->ucast.out.phy; - cp->cis[0 ].p_phy = qos->ucast.out.phy ? qos->ucast.out.phy : + cp->cis[0 ].p_phys = qos->ucast.out.phy ? qos->ucast.out.phy : qos->ucast.in.phy; cp->cis[0 ].c_rtn = qos->ucast.in.rtn; cp->cis[0 ].p_rtn = qos->ucast.out.rtn;
monitor/bt.h +6 -6
@@ -197,8 +197,8 @@ struct bt_ll_clock_acc {struct bt_ll_cis_req {uint8_t cig;uint8_t cis; -uint8_t c_phy; -uint8_t p_phy; +uint8_t c_phys; +uint8_t p_phys;uint16_t c_sdu;uint16_t p_sdu;uint8_t c_interval[3 ];
@@ -2720,8 +2720,8 @@ struct bt_hci_cis_params {uint8_t cis_id;uint16_t c_sdu;uint16_t p_sdu; -uint8_t c_phy; -uint8_t p_phy; +uint8_t c_phys; +uint8_t p_phys;uint8_t c_rtn;uint8_t p_rtn; } __attribute__ ((packed));
@@ -2755,8 +2755,8 @@ struct bt_hci_cis_params_test {uint16_t p_sdu;uint16_t c_pdu;uint16_t p_pdu; -uint8_t c_phy; -uint8_t p_phy; +uint8_t c_phys; +uint8_t p_phys;uint8_t c_bn;uint8_t p_bn; } __attribute__ ((packed));
monitor/ll.c +4 -4
@@ -656,16 +656,16 @@ static void cis_req(const void *data, uint8_t size)print_field ("CIG ID: 0x%2.2x" , cmd->cig);print_field ("CIS ID: 0x%2.2x" , cmd->cis); -print_field ("Central to Peripheral PHY: 0x%2.2x" , cmd->c_phy); +print_field ("Central to Peripheral PHYs: 0x%2.2x" , cmd->c_phys); - mask =print_bitfield (2 , cmd->c_phy, le_phys); + mask =print_bitfield (2 , cmd->c_phys, le_phys);if (mask)print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" " (0x%2.2x)" , mask); -print_field ("Peripheral To Central PHY: 0x%2.2x" , cmd->p_phy); +print_field ("Peripheral To Central PHYs: 0x%2.2x" , cmd->p_phys); - mask =print_bitfield (2 , cmd->p_phy, le_phys); + mask =print_bitfield (2 , cmd->p_phys, le_phys);if (mask)print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" " (0x%2.2x)" , mask);
monitor/packet.c +9 -9
@@ -7768,7 +7768,7 @@ static const struct bitfield_data le_phys[] = { { } }; -static void print_le_phy_bitfield (const char *label,uint8_t phys) +static void print_le_phys (const char *label,uint8_t phys) {uint8_t mask;
@@ -7798,8 +7798,8 @@ static void print_le_phys_preference(uint8_t all_phys, uint8_t tx_phys,print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" " (0x%2.2x)" , mask); -print_le_phy_bitfield ("TX PHYs preference" , tx_phys); -print_le_phy_bitfield ("RX PHYs preference" , rx_phys); +print_le_phys ("TX PHYs preference" , tx_phys); +print_le_phys ("RX PHYs preference" , rx_phys); } static void le_set_default_phy_cmd(uint16_t index, const void *data,
@@ -8853,8 +8853,8 @@ static void print_cis_params(const void *data, int i) le16_to_cpu(cis->c_sdu));print_field ("Peripheral to Central Maximum SDU Size: %u" ,le16_to_cpu (cis->p_sdu)); -print_le_phy ("Central to Peripheral PHY" , cis->c_phy); -print_le_phy ("Peripheral to Central PHY" , cis->p_phy); +print_le_phys ("Central to Peripheral PHYs" , cis->c_phys); +print_le_phys ("Peripheral to Central PHYs" , cis->p_phys);print_field ("Central to Peripheral Retransmission attempts: 0x%2.2x" , cis->c_rtn); print_field("Peripheral to Central Retransmission attempts: 0x%2.2x",
@@ -8900,8 +8900,8 @@ static void print_cis_params_test(const void *data, int i) le16_to_cpu(cis->c_pdu));print_field ("Peripheral to Central Maximum PDU: 0x%4.4x" ,le16_to_cpu (cis->p_pdu)); -print_le_phy ("Central to Peripheral PHY" , cis->c_phy); -print_le_phy ("Peripheral to Central PHY" , cis->p_phy); +print_le_phys ("Central to Peripheral PHYs" , cis->c_phys); +print_le_phys ("Peripheral to Central PHYs" , cis->p_phys);print_field ("Central to Peripheral Burst Number: 0x%2.2x" , cis->c_bn);print_field ("Peripheral to Central Burst Number: 0x%2.2x" , cis->p_bn); }
@@ -9764,7 +9764,7 @@ static void le_fsu_cmd(uint16_t index, const void *data, uint8_t size)print_field ("Frame Space max: %d us (0x%4.4x)" ,le16_to_cpu (cmd->frame_space_max),le16_to_cpu (cmd->frame_space_max)); -print_le_phy_bitfield ("PHYs" , cmd->phys); +print_le_phys ("PHYs" , cmd->phys);print_fsu_types (cmd->types); }
@@ -13325,7 +13325,7 @@ static void le_fsu_evt(struct timeval *tv, uint16_t index,print_field ("Frame Space: %u us (0x%4.4x)" ,le16_to_cpu (evt->frame_space),le16_to_cpu (evt->frame_space)); -print_le_phy_bitfield ("PHYs" , evt->phys); +print_le_phys ("PHYs" , evt->phys);print_fsu_types (evt->types); }
Signature · 1 line
2.52.0
Luiz Augusto von Dentz
maintainerPATCH 2/3 emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values
From: Luiz Augusto von Dentz <[email protected]>
BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs are bitfield so they need to be converted to values when emitting BT_HCI_EVT_LE_CIS_ESTABLISHED.
--- emulator/btdev.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
emulator/btdev.c +19 -2
@@ -6955,6 +6955,23 @@ static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval,return latency >= interval ? latency : interval; } +static uint8_t bits_to_phy (uint8_t bits) +{ +uint8_t phy =0x00 ; + +/* Convert PHY bits to PHY values on a ascending order. */ +if (bits &BIT (0 )) + phy =0x01 ;/* LE 1M */ + +if (bits &BIT (1 )) + phy =0x02 ;/* LE 2M */ + +if (bits &BIT (2 )) + phy =0x03 ;/* LE Coded */ + +return phy; +} +static void le_cis_estabilished (struct btdev *dev,struct btdev_conn *conn,uint8_t status) {
@@ -6977,8 +6994,8 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,memset (evt.cig_sync_delay,0 ,sizeof (evt.cig_sync_delay));memset (evt.cis_sync_delay,0 ,sizeof (evt.cis_sync_delay)); - evt.c_phy = le_cig->cis[cis_idx].c_phys; - evt.p_phy = le_cig->cis[cis_idx].p_phys; + evt.c_phy =bits_to_phy (le_cig->cis[cis_idx].c_phys); + evt.p_phy =bits_to_phy (le_cig->cis[cis_idx].p_phys); evt.nse =0x01 ; evt.c_bn =0x01 ; evt.p_bn =0x01 ;
Signature · 1 line
2.52.0
Luiz Augusto von Dentz
maintainerPATCH 3/3 monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
The PHY field of BT_HCI_BIT_LE_CREATE_BIG are bitfields rather than a value, so this changes the fields to phy's' and fixes the parsing to print it as bitfield rather than value and also make the emulator to use bits_to_phy to convert when emitting the likes of BT_HCI_EVT_LE_BIG_COMPLETE.
--- emulator/btdev.c | 38 +++++++++++++++++++------------------- emulator/bthost.c | 2 +- monitor/bt.h | 4 ++-- monitor/packet.c | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-)
emulator/btdev.c +19 -19
@@ -5778,6 +5778,23 @@ static int cmd_set_pa_data(struct btdev *dev, const void *data,return 0 ; } +static uint8_t bits_to_phy (uint8_t bits) +{ +uint8_t phy =0x00 ; + +/* Convert PHY bits to PHY values on a ascending order. */ +if (bits &BIT (0 )) + phy =0x01 ;/* LE 1M */ + +if (bits &BIT (1 )) + phy =0x02 ;/* LE 2M */ + +if (bits &BIT (2 )) + phy =0x03 ;/* LE Coded */ + +return phy; +} +static void send_biginfo (struct btdev *dev,const struct btdev *remote,uint16_t sync_handle) {
@@ -5806,7 +5823,7 @@ static void send_biginfo(struct btdev *dev, const struct btdev *remote, ev.max_pdu = bis->sdu;memcpy (ev.sdu_interval, bis->sdu_interval,sizeof (ev.sdu_interval)); ev.max_sdu = bis->sdu; - ev.phy = bis->phy; + ev.phy =bits_to_phy (bis->phys); ev.framing = bis->framing; ev.encryption = bis->encryption;
@@ -6955,23 +6972,6 @@ static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval,return latency >= interval ? latency : interval; } -static uint8_t bits_to_phy (uint8_t bits) -{ -uint8_t phy =0x00 ; - -/* Convert PHY bits to PHY values on a ascending order. */ -if (bits &BIT (0 )) - phy =0x01 ;/* LE 1M */ - -if (bits &BIT (1 )) - phy =0x02 ;/* LE 2M */ - -if (bits &BIT (2 )) - phy =0x03 ;/* LE Coded */ - -return phy; -} -static void le_cis_estabilished (struct btdev *dev,struct btdev_conn *conn,uint8_t status) {
@@ -7255,7 +7255,7 @@ static int cmd_create_big_complete(struct btdev *dev, const void *data, } evt.handle = cmd->handle; - evt.phy = bis->phy; + evt.phy =bits_to_phy (bis->phys); evt.max_pdu = bis->sdu;memcpy (evt.sync_delay, bis->sdu_interval,3 );memcpy (evt.latency, bis->sdu_interval,3 );
emulator/bthost.c +1 -1
@@ -3831,7 +3831,7 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis, cp.bis.sdu =40 ; cp.bis.latency =cpu_to_le16 (10 ); cp.bis.rtn =0x02 ; - cp.bis.phy =0x02 ; + cp.bis.phys =BIT (2 ); cp.bis.encryption = enc;memcpy (cp.bis.bcode, bcode,sizeof (cp.bis.bcode));send_command (bthost,BT_HCI_CMD_LE_CREATE_BIG , &cp,sizeof (cp));
monitor/bt.h +2 -2
@@ -2818,7 +2818,7 @@ struct bt_hci_bis {uint16_t sdu;uint16_t latency;uint8_t rtn; -uint8_t phy; +uint8_t phys;uint8_t packing;uint8_t framing;uint8_t encryption;
@@ -2840,7 +2840,7 @@ struct bt_hci_bis_test {uint8_t nse;uint16_t sdu;uint16_t pdu; -uint8_t phy; +uint8_t phys;uint8_t packing;uint8_t framing;uint8_t bn;
monitor/packet.c +2 -2
@@ -9025,7 +9025,7 @@ static void print_bis(const struct bt_hci_bis *bis)print_field ("Maximum Latency: %u ms (0x%4.4x)" ,le16_to_cpu (bis->latency),le16_to_cpu (bis->latency));print_field ("RTN: 0x%2.2x" , bis->rtn); -print_le_phy ("PHY" , bis->phy); +print_le_phys ("PHYs" , bis->phys);print_packing (bis->packing);print_framing (bis->framing);print_field ("Encryption: 0x%2.2x" , bis->encryption);
@@ -9055,7 +9055,7 @@ static void print_bis_test(const void *data, int i)print_field ("Maximum PDU: %u" , bis->pdu);print_packing (bis->packing);print_framing (bis->framing); -print_le_phy ("PHY" , bis->phy); +print_le_phys ("PHYs" , bis->phys);print_field ("Burst Number: %u" , bis->bn);print_field ("Immediate Repetition Count: %u" , bis->irc);print_field ("Pre Transmission Offset: 0x%2.2x" , bis->pto);
Signature · 1 line
2.52.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1035801
---Test result---
Test Summary:
CheckPatch PENDING 0.30 seconds GitLint PENDING 0.31 seconds BuildEll PASS 19.97 seconds BluezMake PASS 627.66 seconds MakeCheck PASS 22.09 seconds MakeDistcheck PASS 239.58 seconds CheckValgrind PASS 299.14 seconds CheckSmatch WARNING 350.46 seconds bluezmakeextell PASS 182.47 seconds IncrementalBuild PENDING 0.30 seconds ScanBuild PASS 1031.97 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:emulator/btdev.c:470:29: warning: Variable length array is used.emulator/bthost.c:700:28: warning: Variable length array is used.emulator/bthost.c:701:32: warning: Variable length array is used.emulator/bthost.c:918:28: warning: Variable length array is used.emulator/bthost.c:952:28: warning: Variable length array is used.emulator/bthost.c:953:32: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1933:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresemulator/btdev.c:470:29: warning: Variable length array is used.emulator/btdev.c:470:29: warning: Variable length array is used.emulator/bthost.c:700:28: warning: Variable length array is used.emulator/bthost.c:701:32: warning: Variable length array is used.emulator/bthost.c:918:28: warning: Variable length array is used.emulator/bthost.c:952:28: warning: Variable length array is used.emulator/bthost.c:953:32: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1933:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 5 lines · On Mon, 22 Dec 2025 14:35:02 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
The fields of
BT_HCI_CMD_LE_SET_CIG_PARAMSare bitfields rather than values, so this changes the fields to phy's' and fixes the parsing to print it as bitfield rather than value.
Quoted 7 lines
--- emulator/btdev.c | 4 ++-- emulator/bthost.c | 4 ++-- monitor/bt.h | 12 ++++++------ monitor/ll.c | 8 ++++---- monitor/packet.c | 18 +++++++++--------- 5 files changed, 23 insertions(+), 23 deletions(-)
Here is the summary with links:
- [BlueZ,v1,1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=11b8db231e52 - [BlueZ,v1,2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=cfdda3b11ec2 - [BlueZ,v1,3/3] monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b35b6befb12c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html