Skip to content

Revise in-hutch camera check from camViewer script #205

@ZLLentz

Description

@ZLLentz

Expected Behavior

The checks in our scripts should be meaningful and correct to give us proper feedback

Current Behavior

There's a place in camViewer where we check if the camera name exists in a hutch via counting and then compare the count to the camera name, which is incorrect. If the line is changed to store the camera name instead of the count we still have some issues because the following checks are a bit wonky.

This gives a confusing printout but doesn't break the script because regardless of the result of the check we proceed anyway.

tmp=/tmp/cv.$$
list_cams "$hutch" >$tmp
c=$(wc <$tmp | grep "$CAMNAME" $tmp | awk '{print $1}')
if [ "$c" == '' ]; then
echo "Camera name not found in hutch. To see which cameras you can access from your current machine use the '-l/--list' option."
sleep 3
elif [ "$c" == "$CAMNAME" ] && [ "$hutch" != "$(get_info --gethutch)" ] ; then
echo "To use camera controls, you must be on the same hutch machine as your camera."
echo "Opening read-only main screen..."
sleep 3
rm -f $tmp
fi

Possible Solution

Revise as appropriate

Context

Originally posted by @ZLLentz in #204 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions