Clean out backwards compatibility cruft, local copy of USB header, packageing

rules and support files that don't really apply anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39763 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2010-12-08 00:44:10 +00:00
parent b994a18508
commit 95fe58a78d
8 changed files with 8 additions and 613 deletions
@@ -1,54 +0,0 @@
#ifndef _BEOS_COMPATIBILITY_H_
#define _BEOS_COMPATIBILITY_H_
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
typedef struct mutex {
sem_id sem;
int32 count;
} mutex;
static inline status_t
mutex_init(mutex *ben, const char *name)
{
if (ben == NULL || name == NULL)
return B_BAD_VALUE;
ben->count = 1;
ben->sem = create_sem(0, name);
if (ben->sem >= B_OK)
return B_OK;
return ben->sem;
}
static inline void
mutex_destroy(mutex *ben)
{
delete_sem(ben->sem);
ben->sem = -1;
}
static inline status_t
mutex_lock(mutex *ben)
{
if (atomic_add(&ben->count, -1) <= 0)
return acquire_sem(ben->sem);
return B_OK;
}
static inline status_t
mutex_unlock(mutex *ben)
{
if (atomic_add(&ben->count, 1) < 0)
return release_sem(ben->sem);
return B_OK;
}
#endif // HAIKU_TARGET_PLATFORM_HAIKU
#endif // _BEOS_COMPATIBILITY_H_
@@ -260,7 +260,6 @@ usb_serial_control(void *cookie, uint32 op, void *arg, size_t length)
}
#if defined(B_BEOS_VERSION_DANO) || defined(__HAIKU__)
/* usb_serial_select - handle select start */
static status_t
usb_serial_select(void *cookie, uint8 event, uint32 ref, selectsync *sync)
@@ -281,7 +280,6 @@ usb_serial_deselect(void *cookie, uint8 event, selectsync *sync)
SerialDevice *device = (SerialDevice *)cookie;
return device->DeSelect(event, sync);
}
#endif // DANO, HAIKU
/* usb_serial_close - handle close() calls */
@@ -357,10 +355,8 @@ find_device(const char *name)
usb_serial_control, /* -> control entry point */
usb_serial_read, /* -> read entry point */
usb_serial_write, /* -> write entry point */
#if defined(B_BEOS_VERSION_DANO) || defined(__HAIKU__)
usb_serial_select, /* -> select entry point */
usb_serial_deselect /* -> deselect entry point */
#endif
};
TRACE_FUNCALLS("> find_device(%s)\n", name);
@@ -8,24 +8,21 @@
#ifndef _USB_SERIAL_DRIVER_H_
#define _USB_SERIAL_DRIVER_H_
#include <OS.h>
#include <KernelExport.h>
#include <Drivers.h>
#include <KernelExport.h>
#include <OS.h>
#include <USB3.h>
#include <lock.h>
#include <string.h>
#ifdef __HAIKU__
#include <lock.h>
#else
#include "BeOSCompatibility.h"
#endif
#include "kernel_cpp.h"
#include "Tracing.h"
#include "USB3.h"
extern "C" {
#include <tty_module.h>
}
#define DRIVER_NAME "usb_serial" // driver name for debug output
#define DEVICES_COUNT 20 // max simultaneously open devices
@@ -1,11 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel drivers ports usb_serial ;
SetSubDirSupportedPlatformsBeOSCompatible ;
if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
UsePrivateKernelHeaders ;
UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers tty ] : true ;
}
UsePrivateKernelHeaders ;
UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers tty ] : true ;
SubDirC++Flags -fno-rtti ;
@@ -21,13 +17,3 @@ KernelAddon usb_serial :
;
AddResources usb_serial : usb_serial.rdef ;
Package haiku-usb_serial-cvs
:
usb_serial
:
boot home config add-ons kernel drivers bin ;
Package haiku-usb_serial-cvs : <usb_serial!driver>usb_serial.settings.sample
: boot home config settings kernel drivers sample ;
@@ -1,262 +0,0 @@
<html>
<title>BeOS driver for USB serial adapters and CDC ACM compatible USB modems</title>
<body bgcolor="#f0f0e0">
<h1>BeOS driver for USB serial adapters and CDC ACM compatible USB modems</h1>
<h2>Introduction</h2>
<p>This driver is designed to support following USB serial adapters and modems:</p>
<table border=1><tbody><tr>
<td><b>Name</b></td><td><b>Vendor ID</b></td><td><b>Product ID</b></td>
</tr><tr>
<td><b>USB CDC ACM-compatible modems:</b></td><td>any</td><td>any</td>
</tr><tr>
<td><b>Prolific PL2303-based adapters:</b></td><td></td><td></td>
</tr><tr>
<td>PL2303 Serial adapter (IODATA USB-RSAQ2)</td><td>0x067b</td><td>0x04bb</td>
</tr><tr>
<td>I/O Data USB serial adapter USB-RSAQ1</td><td>0x04bb</td><td>0x0a03</td>
</tr><tr>
<td>Aten Serial adapter"</td><td>0x0557</td><td>0x2008</td>
</tr><tr>
<td>TDK USB-PHS Adapter UHA6400</td><td>0x04bf</td><td>0x0117</td>
</tr><tr>
<td>Ratoc USB serial adapter REX-USB60</td><td>0x0584</td><td>0xb000</td><td>
</tr><tr>
<td>PL2303 Serial adapter (ATEN/IOGEAR UC232A)</td><td>0x067b</td><td>0x2303</td>
</tr><tr>
<td>Elecom UC-SGT</td><td>0x056e</td><td>0x5003</td>
</tr><tr>
<td><b>FTDI-based:</b></td><td></td><td></td>
</tr><tr>
<td>FTDI 8U100AX serial converter</td><td>0x0403</td><td>0x8372</td>
</tr><tr>
<td>FTDI 8U232AM serial converter</td><td>0x0403</td><td>0x6001</td>
</tr></tbody></table>
<table><tbody><tr><td>
<b><font color="#00ff00">NOTE that</font></b>
</td><td>
There are a lot of USB modems in this world. Not every one can be supported by this driver.
Only CDC ACM-compatible modems will works with it. How you can guess it? Just try to install
this driver and plug your modem in. If you get the usb0 in ports list - it probably works.
If not - <a href="#usbcommander">obtain the information about your device</a> and
<a href="mailto:[email protected]">send it to me</a>.
</td></tr><tr><td>
<b><font color="#00ff00">NOTE that</font></b>
</td><td>
If your computer has the OHCI-compatible USB hardware you are out of luck. This hardware is not
supported by non-Dan0-like versions. See the <a href="#patches">BeOS.USB.patches</a> vor details and
solutions.
</td></tr><tr><td>
<b><font color="#ff0000">NOTE that</font></b>
</td><td>
For Dan0 you have to build a special version of binaries.
Read <a href="#Dan0">here</a> for details.
</td></tr><tr><td>
<b><font color="#ff0000"><blink>WARNING!!!</blink></font></b>
</td><td>
If your system was patched with <a href="#patches">BeOS.USB.patches</a> - your system is candidate to crash
trying this driver!! You must very accurate read <a href="#patches">this.</a>
</td></tr><tbody><table>
<b>What's new:</b>
<table border=1 ><tbody><tr><td>
<b>Version:</b>
</td><td>
<b>History:</b>
</td></tr><tr><td>
0.1.0-dev-0
</td><td>
very first "development" release.
</td></tr></tr><tr><td>
1.0.0-RC-1
</td><td>
Release Candidate 1.
<ul>
<li>Code re-designed
<li>Code is chaged to be compatible with Dan0.
</ul>
</td></tr><tbody><table>
<h2>1. Installation</h2>
<ul>
<li>Run install.sh
<li>If all is OK run SerialConnect application and press Alt-D. If you can select the port, that
looks like "usb0" - your device was identified as supported. You can use this "usb" - port as
you do with usual "serial" ones. Good luck!
<li>If something goes wrong - open the Terminal and run the following command:
<p><strong>ls /dev/ports/</strong>
<p>It lists all ports that present on your system. If you have no "usb0" here but sure, that you
have USB to Serial adapter plugged in your USB port - write an e-mail about your problem. I'll
try to help you.
</ul>
<h2>2. Uninstallation</h2>
<ul>
<li>Run uninstall.sh
</ul>
<h2>3. Problems solving</h2>
<ul>
<li> If this driver crash your system - reboot and press "Space" during load. In boot menu select
"Disable user add-ons" and continue boot. Uninstall driver and reboot again into normal mode.
Write me a e-mail about this problem.
</ul>
<h2>4. "Unknown" devices</h2>
<a name="usbcommander"></a>
If you have something, that looks like USB->RS232(serial) adapter or USB modem and tried it with
this driver but have no success - download <a href="http://www.zharik.host.sk/prahramy/usb_dev_info.zip">
usb device info tool</a> and use it to get required information.
<ul>
<li>Unplug all USB devices and hubs from your PC.
<li>Go into Terminal and run the following command:
<strong> ls -alR /dev/bus/usb</strong>
You should see something like this:
<pre>
$ ls -alR /dev/bus/usb/
/dev/bus/usb:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 Jun 1 2003 ..
drw-r--r-- 1 walther users 0 May 31 23:16 0
drw-r--r-- 1 walther users 0 May 31 23:16 1
crw-r--r-- 1 walther users 0, 0 May 31 23:16 unload
/dev/bus/usb/0:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 May 31 23:16 ..
crw-r--r-- 1 walther users 0, 0 May 31 23:16 hub
/dev/bus/usb/1:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 May 31 23:16 ..
crw-r--r-- 1 walther users 0, 0 May 31 23:16 hub
</pre>
<li> Note this information.
<li> Now plug your USB serial adapter into PC and run <strong>ls -alR /dev/bus/usb/</strong> again.
You'll get something slightly different:
<pre>
$ ls -alR /dev/bus/usb/
/dev/bus/usb:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 Jun 1 2003 ..
drw-r--r-- 1 walther users 0 May 31 23:16 0
drw-r--r-- 1 walther users 0 May 31 23:16 1
crw-r--r-- 1 walther users 0, 0 May 31 23:16 unload
/dev/bus/usb/0:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 May 31 23:16 ..
<blink>crw-r--r-- 1 walther users 0, 0 May 31 23:17 1</blink>
crw-r--r-- 1 walther users 0, 0 May 31 23:16 hub
/dev/bus/usb/1:
total 0
drw-r--r-- 1 walther users 0 May 31 23:16 .
drw-r--r-- 1 walther users 0 May 31 23:16 ..
crw-r--r-- 1 walther users 0, 0 May 31 23:16 hub
</pre>
$
<li> Compare this results with previous one and look for file,
that appeared. This file is your USB serial adapter.
<li> Unpack downloaded usb_dev_info command and run it with full path to file appeared in
the second listing. For my sample I should run:
usb_dev_info /dev/bus/usb/0/1
I'll get the following:
<pre>
$ usb_dev_info /dev/bus/usb/0/1
[Device]
Class .................. 0
Subclass ............... 0
Protocol ............... 0
Vendor ID .............. 0x067b
Product ID ............. 0x2303
Version ................ 0x0202
Manufacturer String .... ""
Product String ......... ""
Serial Number .......... ""
[Configuration 0]
[Interface 0]
Class .............. 255
Subclass ........... 0
Protocol ........... 0
[Endpoint 0]
MaxPacketSize .... 10
Interval ......... 1
Type ............. Interrupt
Direction ........ Input
[Endpoint 1]
MaxPacketSize .... 64
Interval ......... 0
Type ............. Bulk
Direction ........ Output
[Endpoint 2]
MaxPacketSize .... 64
Interval ......... 0
Type ............. Bulk
Direction ........ Input
</pre>
<li> Send this information to me with some additional words about your device.
</ul>
<h2>What is wrong with BeOS.USB.patches?</h2>
<a name="patches"></a>
All know that "classical" BeOS R5 don't works on OHCI USB hardware. But some time ago on one well-known
BeOS file-sharing network appeared patches for plain R5. Those patches allows to work with OHCI
hardware under this system version. Looks like it is some part of Dan0 or other "leaked" versions.
There are 3 patches in BeOS.USB.patches.zip:
<p>1. beos-usb-patch,
<p>2. beos-usb.modem-patch,
<p>3. beos-usb.modem-patch.sm.
<p> The Evil is in two last patches. The source of problem - changed functions in tty module. The
Dan0 contains two additional functions in the middle of tty module description table. But the module version
was not changed - it is still v1. So if driver, that was compiled with old tty module layout, will try to use it - system
crashes. Looks like those patches contains the same "enchanced" tty module like in Dan0. So - you should roll back
those modem-patches - restore the previous configuration as described in patches readme. The first one
- "beos-usb-patch" is OK.
<h2>Information for Dan0 users</h2>
<a name="Dan0"></a>
The driver is still not working under Dan0 out of box. At first you have no need to use it for ACM-compatible devices,
because Dan0 has it's own implementation of usb_acm driver. There is also one problem with Dan0 - the
"tty" module was chaged in very dangerous way - there is no possibility to create backward compatible
implementation of serial port driver with the new tty interfaces. If you really have one of those USB Serial
Adapters and want to use it under Dan0 - you have to make some hand work. Sorry for this, but I have not
using Dan0 as my main working system. So you must to build Dan0 version by yourself. Thank you for your patience. Below
is an operations you need to install USB serial driver for Dan0:
<ul>
<li>Obtain the zip archive with the USB Serial driver for R5.
<li>Obtain the zip archive with sources of the driver.
<li>ATTENTION!!! Unplug all USB devices from your PC. You must to do this - in opposite case you
system can crash!
<li>Install the USB Serial driver as was described in this document.
<li>Unpack the sources of the driver, go to Terminal, change dir to unpacked sources and run the
"make" command. You should see many warnings but no errors.
<li>Stay in Terminal and change the current directory to "obj.x86". You should see the "usb_serial"
driver binary if everything went OK.
<li>Now copy the usb_serial to right place:
<pre>
<b>cp ./usb_serial ~/config/add-ons/kernel/drivers/bin/usb_serial</b>
</pre>
and let the system to know about changes:
<pre>
<b>rescan usb_serial</b>
</pre>
<li>The last thing you have to do - disable ACM support in this driver:
Open the file /boot/home/config/settings/kernel/drivers/usb_serial in your text editor and add or
uncomment the following string:
<pre>
<b>support_acm_devices false</b>
</pre>
<li>Now you should have working version of USB Serial driver under Dan0.
</ul>
<p><b><a href="mailto:[email protected]">Siarzuk Zharski <imker@gmx.li></a></b>
<p><a href="http://www.zharik.host.sk/">http://www.zharik.host.sk/</a>
</body></html>
@@ -1,227 +0,0 @@
/*
* Version 3 USB Device Driver API
*
* Copyright 2006, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _USB_V3_H_
#define _USB_V3_H_
#include <KernelExport.h>
#include <bus_manager.h>
#include <iovec.h>
#include <USB_spec.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct usb_module_info usb_module_info;
typedef uint32 usb_id;
typedef usb_id usb_device;
typedef usb_id usb_interface;
typedef usb_id usb_pipe;
typedef struct usb_endpoint_info usb_endpoint_info;
typedef struct usb_interface_info usb_interface_info;
typedef struct usb_interface_list usb_interface_list;
typedef struct usb_configuration_info usb_configuration_info;
typedef struct usb_notify_hooks {
status_t (*device_added)(usb_device device, void **cookie);
status_t (*device_removed)(void *cookie);
} usb_notify_hooks;
typedef struct usb_support_descriptor {
uint8 dev_class;
uint8 dev_subclass;
uint8 dev_protocol;
uint16 vendor;
uint16 product;
} usb_support_descriptor;
struct usb_endpoint_info {
usb_endpoint_descriptor *descr; /* descriptor and handle */
usb_pipe handle; /* of this endpoint/pipe */
};
struct usb_interface_info {
usb_interface_descriptor *descr; /* descriptor and handle */
usb_interface handle; /* of this interface */
size_t endpoint_count; /* count and list of endpoints */
usb_endpoint_info *endpoint; /* in this interface */
size_t generic_count; /* unparsed descriptors in */
usb_descriptor **generic; /* this interface */
};
struct usb_interface_list {
size_t alt_count; /* count and list of alternate */
usb_interface_info *alt; /* interfaces available */
usb_interface_info *active; /* currently active alternate */
};
struct usb_configuration_info {
usb_configuration_descriptor *descr; /* descriptor of this config */
size_t interface_count;/* interfaces in this config */
usb_interface_list *interface;
};
typedef struct {
int16 request_length;
int16 actual_length;
status_t status;
} usb_iso_packet_descriptor;
// Flags for queue_isochronous
#define USB_ISO_ASAP 0x01
typedef void (*usb_callback_func)(void *cookie, status_t status, void *data,
size_t actualLength);
/* The usb_module_info represents the public API of the USB Stack. */
struct usb_module_info {
bus_manager_info binfo;
/*
* Use register_driver() to inform the Stack of your interest to support
* USB devices. Support descriptors are used to indicate support for a
* specific device class/subclass/protocol or vendor/product.
* A value of 0 can be used as a wildcard for all fields.
*
* Would you like to be notified about all added hubs (class 0x09) you
* would use a support descriptor like this for register_driver:
* usb_support_descriptor hub_devs = { 9, 0, 0, 0, 0 };
*
* If you intend to support just any device, or you at least want to be
* notified about any device, just pass NULL as the supportDescriptor and
* 0 as the supportDescriptorCount to register_driver.
*/
status_t (*register_driver)(const char *driverName,
const usb_support_descriptor *supportDescriptors,
size_t supportDescriptorCount,
const char *optionalRepublishDriverName);
/*
* Install notification hooks using your registered driverName. The
* device_added hook will be called for every device that matches the
* support descriptors you provided in register_driver.
* When first installing the hooks you will receive a notification about
* any already present matching device. If you return B_OK in this hook,
* you can use the id that is provided. If the hook indicates an error,
* the resources will be deallocated and you may not use the usb_device
* that is provided. In this case you will not receive a device_removed
* notification for the device either.
*/
status_t (*install_notify)(const char *driverName,
const usb_notify_hooks *hooks);
status_t (*uninstall_notify)(const char *driverName);
/* Get the device descriptor of a device. */
const usb_device_descriptor *(*get_device_descriptor)(usb_device device);
/* Get the nth supported configuration of a device*/
const usb_configuration_info *(*get_nth_configuration)(usb_device device,
uint index);
/* Get the current configuration */
const usb_configuration_info *(*get_configuration)(usb_device device);
/* Set the current configuration */
status_t (*set_configuration)(usb_device device,
const usb_configuration_info *configuration);
status_t (*set_alt_interface)(usb_device device,
const usb_interface_info *interface);
/*
* Standard device requests - convenience functions
* The provided handle may be a usb_device, usb_pipe or usb_interface
*/
status_t (*set_feature)(usb_id handle, uint16 selector);
status_t (*clear_feature)(usb_id handle, uint16 selector);
status_t (*get_status)(usb_id handle, uint16 *status);
status_t (*get_descriptor)(usb_device device,
uint8 descriptorType, uint8 index,
uint16 languageID, void *data,
size_t dataLength,
size_t *actualLength);
/* Generic device request function - synchronous */
status_t (*send_request)(usb_device device,
uint8 requestType, uint8 request,
uint16 value, uint16 index,
uint16 length, void *data,
size_t *actualLength);
/*
* Asynchronous request queueing. These functions return immediately
* and the return code only tells whether the _queuing_ of the request
* was successful or not. It doesn't indicate transfer success or error.
*
* When the transfer is finished, the provided callback function is
* called with the transfer status, a pointer to the data buffer and
* the actually transfered length as well as with the callbackCookie
* that was used when queuing the request.
*/
status_t (*queue_interrupt)(usb_pipe pipe,
void *data, size_t dataLength,
usb_callback_func callback,
void *callbackCookie);
status_t (*queue_bulk)(usb_pipe pipe,
void *data, size_t dataLength,
usb_callback_func callback,
void *callbackCookie);
status_t (*queue_bulk_v)(usb_pipe pipe,
iovec *vector, size_t vectorCount,
usb_callback_func callback,
void *callbackCookie);
status_t (*queue_isochronous)(usb_pipe pipe,
void *data, size_t dataLength,
usb_iso_packet_descriptor *packetDesc,
uint32 packetCount,
uint32 *startingFrameNumber,
uint32 flags,
usb_callback_func callback,
void *callbackCookie);
status_t (*queue_request)(usb_device device,
uint8 requestType, uint8 request,
uint16 value, uint16 index,
uint16 length, void *data,
usb_callback_func callback,
void *callbackCookie);
status_t (*set_pipe_policy)(usb_pipe pipe,
uint8 maxNumQueuedPackets,
uint16 maxBufferDurationMS,
uint16 sampleSize);
/* Cancel all pending async requests in a pipe */
status_t (*cancel_queued_transfers)(usb_pipe pipe);
/* tuning, timeouts, etc */
status_t (*usb_ioctl)(uint32 opcode, void *buffer,
size_t bufferSize);
};
#define B_USB_MODULE_NAME "bus_managers/usb/v3"
#ifdef __cplusplus
}
#endif
#endif /* !_USB_V3_H_ */
@@ -1,24 +0,0 @@
#!/bin/sh
DRIVER_TITLE="USB Serial"
DRIVER_NAME=usb_serial
answer=`alert "Do you really want to install the $DRIVER_TITLE driver?" "No" "Yes"`
if [ $answer == "No" ]; then
exit
fi
/boot/beos/bin/install -d ~/config/add-ons/kernel/drivers/bin/
/boot/beos/bin/install -d ~/config/settings/kernel/drivers/
/boot/beos/bin/install -d ~/config/add-ons/kernel/drivers/dev/ports/
/boot/beos/bin/install `dirname $0`/$DRIVER_NAME ~/config/add-ons/kernel/drivers/bin/
/boot/beos/bin/cp `dirname $0`/$DRIVER_NAME.settings.sample ~/config/settings/kernel/drivers/$DRIVER_NAME
mimeset ~/config/add-ons/kernel/drivers/bin/$DRIVER_NAME
mimeset ~/config/settings/kernel/drivers/$DRIVER_NAME
ln -sf ../../bin/$DRIVER_NAME ~/config/add-ons/kernel/drivers/dev/ports/$DRIVER_NAME
rescan $DRIVER_NAME
alert "The $DRIVER_TITLE driver has been installed in your system."
@@ -1,17 +0,0 @@
#!/bin/sh
DRIVER_TITLE="USB Serial"
DRIVER_NAME=usb_serial
answer=`alert "Do you really want to uninstall the $DRIVER_TITLE driver?" "No" "Yes"`
if [ $answer == "No" ]; then
exit
fi
rm ~/config/add-ons/kernel/drivers/bin/$DRIVER_NAME
rm ~/config/settings/kernel/drivers/$DRIVER_NAME
rm ~/config/add-ons/kernel/drivers/dev/ports/$DRIVER_NAME
rescan $DRIVER_NAME
alert "The $DRIVER_TITLE driver has been removed from your system."