Re: [PATCH] Fix display of last device classes in hciconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

On Tue, Mar 16, 2010 at 9:33 AM, Daniel Abraham
<daniel.shrugged@xxxxxxxxx> wrote:
> This is my first ever patch, so it's very simple...
> Based on current content in:
> http://www.bluetooth.org/assigned-numbers/baseband.htm
>

It's nice that this is your first (of many, I hope ;-) contribution,
but I feel it's better if we left the commit message with just
explaining what the patch does.

> Signed-off-by: Daniel Abraham <daniel.shrugged@xxxxxxxxx>

We don't use the "Signed-off-by" line in BlueZ userland code.

> ---
>  tools/hciconfig.c |   30 ++++++++++++++++++++++++++----
>  1 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/tools/hciconfig.c b/tools/hciconfig.c
> index 3f687e0..c97ce44 100644
> --- a/tools/hciconfig.c
> +++ b/tools/hciconfig.c
> @@ -645,8 +645,26 @@ static char *get_minor_device_name(int major, int minor)
>                        return "Game";
>                }
>                break;
> -       case 63:        /* uncategorised */
> -               return "";

I think that the test for the "Uncategorised" (which seems to be
misspelled in many places) device class would be better staying here,
because the same code is used inside hcitool.c. Fixing there would be
nice too.

Another thing, looks like this "case 63:" is wrong,  major device
class is a 5 bit number, and the uncategorized device class is defined
as 31. Looks like a legacy from ancient times ;-)

> +       case 9: /* health */
> +               switch(minor) {
> +               case 0:
> +                       return "Undefined";
> +               case 1:
> +                       return "Blood Pressure Monitor";
> +               case 2:
> +                       return "Thermometer";
> +               case 3:
> +                       return "Weighing Scale";
> +               case 4:
> +                       return "Glucose Meter";
> +               case 5:
> +                       return "Pulse Oximeter";
> +               case 6:
> +                       return "Heart/Pulse Rate Monitor";
> +               case 7:
> +                       return "Health Data Display";
> +               }
> +               break;
>        }
>        return "Unknown (reserved) minor device class";
>  }
> @@ -668,7 +686,9 @@ static void cmd_class(int ctl, int hdev, char *opt)
>                                        "Audio/Video",
>                                        "Peripheral",
>                                        "Imaging",
> -                                       "Uncategorized" };
> +                                       "Wearable",
> +                                       "Toy",
> +                                       "Health" };
>        int s = hci_open_dev(hdev);
>
>        if (s < 0) {
> @@ -706,7 +726,9 @@ static void cmd_class(int ctl, int hdev, char *opt)
>                } else
>                        printf("Unspecified");
>                printf("\n\tDevice Class: ");
> -               if ((cls[1] & 0x1f) >= sizeof(major_devices) / sizeof(*major_devices))
> +               if (0x1f == cls[1])

This test is inverted, in BlueZ code we use the form: (variable
operator constant)

> +                       printf("Uncategorized\n");
> +               else if ((cls[1] & 0x1f) >= sizeof(major_devices) / sizeof(*major_devices))

See above.

>                        printf("Invalid Device Class!\n");
>                else
>                        printf("%s, %s\n", major_devices[cls[1] & 0x1f],
> --
> 1.6.6.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


Cheers,
-- 
Vinicius Gomes
INdT - Instituto Nokia de Tecnologia
��.n��������+%������w��{.n�����{����^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�m


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux