edgexfoundry / device-usb-camera

Owner: Device WG
Apache License 2.0
12 stars 28 forks source link

Panic when device is missing CardName or SerialNumber (Minnesota) #263

Closed presatish closed 1 year ago

presatish commented 1 year ago

🐞 Bug Report

Affected Services [REQUIRED]

device-usb-camera

Is this a regression?

No

Description and Minimal Reproduction [REQUIRED]

curl -X POST -H 'Content-Type: application/json'  http://localhost:59881/api/v2/device -d '[
    {
    "apiVersion" : "v2",
    "device": {
        "name": "usb-camera",
        "serviceName": "device-usb-camera",
        "profileName": "USB-Camera-General",
        "description": "My test camera",
        "adminState": "UNLOCKED",
        "operatingState": "UP",
        "protocols": {
            "USB": {
                "CardName": "Webcam C270 HD",
                "Path": "/dev/video0",
                "AutoStreaming": "false"
            }
        }
    }
    }
]'

🔥 Exception or Error

panic: interface conversion: interface {} is nil, not string

🌍 Your Environment

Deployment Environment: Docker, Docker + Dev Hybrid

EdgeX Version [REQUIRED]: 3.0

Anything else relevant? This issue will be fixed in main. CardName and SerialNumber are optional parameters but the service does not have proper checks and when the device is added manually without one or both of these parameters the issue is seen. With the fixed service, based on their respective needs users can manually add a camera with or without these parameters.

lenny-goodell commented 1 year ago

@presatish , the work around for this is to add blank CardName and SerialNumber correct?

lenny-goodell commented 1 year ago

The examples here should have the work around added https://github.com/edgexfoundry/device-usb-camera/blob/main/cmd/res/devices/general.usb.camera.yaml.example https://github.com/edgexfoundry/device-usb-camera/blob/main/cmd/res/devices/hp.w200.yaml.example

presatish commented 1 year ago

@presatish , the work around for this is to add blank CardName and SerialNumber correct?

There is no need for blank ones, the blank ones will lead to errors. Either the user can add these fields with their respective values or can completely omit them as we have in the examples now.

lenny-goodell commented 1 year ago

@presatish , I am talking about work around for Minnesota, since this is only being fix in Napa.