Files
OpenCellular/extra/usb_serial/raiden.c
Anton Staaf ac375d000e USB-console: Add Linux USB serial kernel module
This is a simple kernel module and Makefile for
building it out of tree.  This module just uses
the existing kernel usb serial driver and probes
for the Google VID/Class/SubClass/Protocol that
identifies a valid simple serial interface.

This code should be rolled into the existing kernel
driver at: drivers/usb/serial/usb-serial-simple.c

While that happens, this module is still useful to
developers.

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

BRANCH=None
BUG=None
TEST=cd extra/usb_serial; make; sudo insmod raiden.ko
     Connect the discovery-stm32f072 over USB and see
     that its console is discovered and works.

Change-Id: I83661b816643c43b3e2dc9fdc825bc3a796af2f4
Reviewed-on: https://chromium-review.googlesource.com/225923
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-10-29 18:38:27 +00:00

47 lines
1.2 KiB
C

/*
* USB Serial module for Raiden USB debug serial console forwarding.
* SubClass and Protocol allocated in go/usb-ids
*
* Copyright (c) 2014 The Chromium OS Authors <chromium-os-dev@chromium.org>
* Author: Anton Staaf <robotboy@chromium.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
MODULE_LICENSE("GPL");
#define USB_VENDOR_ID_GOOGLE 0x18d1
#define USB_SUBCLASS_GOOGLE_SERIAL 0x50
#define USB_PROTOCOL_GOOGLE_SERIAL 0x01
static struct usb_device_id const ids[] = {
{ USB_VENDOR_AND_INTERFACE_INFO(USB_VENDOR_ID_GOOGLE,
USB_CLASS_VENDOR_SPEC,
USB_SUBCLASS_GOOGLE_SERIAL,
USB_PROTOCOL_GOOGLE_SERIAL) },
{ 0 }
};
MODULE_DEVICE_TABLE(usb, ids);
static struct usb_serial_driver device =
{
.driver = { .owner = THIS_MODULE,
.name = "Google" },
.id_table = ids,
.num_ports = 1,
};
static struct usb_serial_driver * const drivers[] = { &device, NULL };
module_usb_serial_driver(drivers, ids);