Files
OpenCellular/extra/usb_serial/add_usb_serial_id
Anton Staaf 4e3cbd845b USB Serial: Add fallback rule and script
This rule makes it easier to use CCD devices when the raiden module
can't be installed for some reason.  The rule informs the usbserial
module that it should handle anything that looks like a simple serial
port for any CCD compatible USB devices.

The install script now detects failure when building and installing
the raiden module and offers the --fallback option in that case.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I617bbdfb4c5cb9e9803f4088c651f84e3f72bd28
Reviewed-on: https://chromium-review.googlesource.com/351873
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-06-15 13:08:22 -07:00

33 lines
904 B
Bash
Executable File

#!/bin/sh -e
#
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Add a USB VID:PID device ID to the usbserial list of handled devices
if [ $# -ne 2 ]; then
echo ""
echo "Usage: $0 <VID> <PID>"
echo ""
echo "Add a USB VID:PID device identification pair to the list of devices"
echo "that usbserial will recognize. This script ensures that a device is"
echo "not added more than once."
echo ""
exit 1
fi
#
# Firts ensure that the usbserial module is loaded. This is required as there
# may be no other USB serial adaptor connected yet.
#
modprobe usbserial
device_id="$1 $2"
file="/sys/bus/usb-serial/drivers/generic/new_id"
#
# Only add the device ID pair if it isn't already in the ID list.
#
grep -q "$device_id" $file || echo $device_id > $file