diff --git a/tools/hcidump.c b/tools/hcidump.c
index b3b7150..9fb282b 100644
--- a/tools/hcidump.c
+++ b/tools/hcidump.c
msg.msg_control = ctrl;
msg.msg_controllen = 100;
- if( (len = recvmsg(fd, &msg, 0)) < 0 ){
+ if ((len = recvmsg(fd, &msg, 0)) < 0) {
perror("Receive failed");
exit(1);
}
/* Process control message */
in = 0;
cmsg = CMSG_FIRSTHDR(&msg);
- while( cmsg ){
- switch(cmsg->cmsg_type){
- case HCI_CMSG_DIR:
- in = *((int *)CMSG_DATA(cmsg));
- break;
+ while (cmsg) {
+ switch (cmsg->cmsg_type) {
+ case HCI_CMSG_DIR:
+ in = *((int *)CMSG_DATA(cmsg));
+ break;
}
cmsg = CMSG_NXTHDR(&msg, cmsg);
}
flags = 0;
while ((opt=getopt(argc, argv,"i:s:ha")) != EOF) {
- switch(opt) {
+ switch (opt) {
case 'i':
dev = atoi(optarg+3);
break;
}
/* Create HCI socket */
- if( (s=socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0 ) {
+ if ((s=socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) {
perror("Can't create HCI socket");
exit(1);
}
opt = 1;
- if( setsockopt(s, SOL_HCI, HCI_DATA_DIR, &opt, sizeof(opt)) < 0 ) {
+ if (setsockopt(s, SOL_HCI, HCI_DATA_DIR, &opt, sizeof(opt)) < 0) {
perror("Can't enable data direction info");
exit(1);
}
/* Bind socket to the HCI device */
addr.hci_family = AF_BLUETOOTH;
addr.hci_dev = dev;
- if( bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0 ) {
+ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
printf("Can't attach to device hci%d. %s(%d)\n",
dev, strerror(errno), errno);
exit(1);