Merge branch 'master' into x86_64
This commit is contained in:
@@ -435,7 +435,7 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] {
|
|||||||
HAIKU_BUILD_FEATURE_WEBKIT = 1 ;
|
HAIKU_BUILD_FEATURE_WEBKIT = 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAIKU_WEBKIT_FILE = haikuwebkit-1.1.2-x86-gcc4-2012-07-11.zip ;
|
HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-07-20-1.zip ;
|
||||||
|
|
||||||
if $(HAIKU_BUILD_FEATURE_WEBKIT) {
|
if $(HAIKU_BUILD_FEATURE_WEBKIT) {
|
||||||
if $(TARGET_ARCH) != x86 {
|
if $(TARGET_ARCH) != x86 {
|
||||||
|
|||||||
@@ -385,9 +385,8 @@ protected:
|
|||||||
virtual void DoLayout();
|
virtual void DoLayout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init(bool showHorizontalScrollbar);
|
void _Init();
|
||||||
void _GetChildViewRects(const BRect& bounds,
|
void _GetChildViewRects(const BRect& bounds,
|
||||||
bool showHorizontalScrollBar,
|
|
||||||
BRect& titleRect, BRect& outlineRect,
|
BRect& titleRect, BRect& outlineRect,
|
||||||
BRect& vScrollBarRect,
|
BRect& vScrollBarRect,
|
||||||
BRect& hScrollBarRect);
|
BRect& hScrollBarRect);
|
||||||
@@ -404,6 +403,7 @@ private:
|
|||||||
bool fSortingEnabled;
|
bool fSortingEnabled;
|
||||||
float fLatchWidth;
|
float fLatchWidth;
|
||||||
border_style fBorderStyle;
|
border_style fBorderStyle;
|
||||||
|
bool fShowingHorizontalScrollBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _COLUMN_LIST_VIEW_H
|
#endif // _COLUMN_LIST_VIEW_H
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2012, Ingo Weinhold, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _ARGUMENT_VECTOR_H
|
||||||
|
#define _ARGUMENT_VECTOR_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
|
class ArgumentVector {
|
||||||
|
public:
|
||||||
|
enum ParseError {
|
||||||
|
NO_ERROR,
|
||||||
|
NO_MEMORY,
|
||||||
|
UNTERMINATED_QUOTED_STRING,
|
||||||
|
TRAILING_BACKSPACE
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
ArgumentVector();
|
||||||
|
~ArgumentVector();
|
||||||
|
|
||||||
|
int32 ArgumentCount() const { return fCount; }
|
||||||
|
const char* const* Arguments() const { return fArguments; }
|
||||||
|
|
||||||
|
char** DetachArguments();
|
||||||
|
// Caller must free() -- it's all one big allocation at the
|
||||||
|
// returned pointer.
|
||||||
|
|
||||||
|
ParseError Parse(const char* commandLine,
|
||||||
|
const char** _errorLocation = NULL);
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct Parser;
|
||||||
|
|
||||||
|
private:
|
||||||
|
char** fArguments;
|
||||||
|
int32 fCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
using BPrivate::ArgumentVector;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _ARGUMENT_VECTOR_H
|
||||||
@@ -4,10 +4,16 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Siarzhuk Zharski <[email protected]>
|
* Copyright (c) 2003 by Siarzhuk Zharski <[email protected]>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "FTDI.h"
|
#include "FTDI.h"
|
||||||
#include "FTDIRegs.h"
|
#include "FTDIRegs.h"
|
||||||
|
|
||||||
|
|
||||||
FTDIDevice::FTDIDevice(usb_device device, uint16 vendorID, uint16 productID,
|
FTDIDevice::FTDIDevice(usb_device device, uint16 vendorID, uint16 productID,
|
||||||
const char *description)
|
const char *description)
|
||||||
: SerialDevice(device, vendorID, productID, description),
|
: SerialDevice(device, vendorID, productID, description),
|
||||||
@@ -46,7 +52,7 @@ FTDIDevice::AddDevice(const usb_configuration_info *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pipesSet >= 3) {
|
if (pipesSet >= 3) {
|
||||||
if (ProductID() == PRODUCT_FTDI_8U100AX)
|
if (ProductID() == 0x8372) // AU100AX
|
||||||
fHeaderLength = 1;
|
fHeaderLength = 1;
|
||||||
else
|
else
|
||||||
fHeaderLength = 0;
|
fHeaderLength = 0;
|
||||||
@@ -84,7 +90,8 @@ FTDIDevice::SetLineCoding(usb_cdc_line_coding *lineCoding)
|
|||||||
lineCoding->databits);
|
lineCoding->databits);
|
||||||
|
|
||||||
int32 rate = 0;
|
int32 rate = 0;
|
||||||
if (ProductID() == PRODUCT_FTDI_8U100AX) {
|
if (ProductID() == 0x8372) {
|
||||||
|
// AU100AX
|
||||||
switch (lineCoding->speed) {
|
switch (lineCoding->speed) {
|
||||||
case 300: rate = ftdi_sio_b300; break;
|
case 300: rate = ftdi_sio_b300; break;
|
||||||
case 600: rate = ftdi_sio_b600; break;
|
case 600: rate = ftdi_sio_b600; break;
|
||||||
|
|||||||
@@ -4,16 +4,24 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Siarzhuk Zharski <[email protected]>
|
* Copyright (c) 2003 by Siarzhuk Zharski <[email protected]>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef _USB_FTDI_H_
|
#ifndef _USB_FTDI_H_
|
||||||
#define _USB_FTDI_H_
|
#define _USB_FTDI_H_
|
||||||
|
|
||||||
|
|
||||||
#include "SerialDevice.h"
|
#include "SerialDevice.h"
|
||||||
|
|
||||||
|
|
||||||
/* supported vendor and product ids */
|
/* supported vendor and product ids */
|
||||||
#define VENDOR_FTDI 0x0403
|
#define VENDOR_FTDI 0x0403
|
||||||
#define PRODUCT_FTDI_8U100AX 0x8372
|
|
||||||
#define PRODUCT_FTDI_8U232AM 0x6001
|
const usb_serial_device kFTDIDevices[] = {
|
||||||
|
{VENDOR_FTDI, 0x8372, "FTDI 8U100AX serial converter"},
|
||||||
|
{VENDOR_FTDI, 0x6001, "FTDI 8U232AM serial converter"}
|
||||||
|
};
|
||||||
|
|
||||||
#define FTDI_BUFFER_SIZE 64
|
#define FTDI_BUFFER_SIZE 64
|
||||||
|
|
||||||
@@ -40,4 +48,5 @@ private:
|
|||||||
uint8 fStatusLSR;
|
uint8 fStatusLSR;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //_USB_FTDI_H_
|
#endif //_USB_FTDI_H_
|
||||||
|
|||||||
@@ -8,13 +8,19 @@
|
|||||||
#ifndef _USB_KLSI_H_
|
#ifndef _USB_KLSI_H_
|
||||||
#define _USB_KLSI_H_
|
#define _USB_KLSI_H_
|
||||||
|
|
||||||
|
|
||||||
#include "SerialDevice.h"
|
#include "SerialDevice.h"
|
||||||
|
|
||||||
|
|
||||||
/* supported vendor and product ids */
|
/* supported vendor and product ids */
|
||||||
#define VENDOR_PALM 0x0830
|
#define VENDOR_PALM 0x0830
|
||||||
#define VENDOR_KLSI 0x05e9
|
#define VENDOR_KLSI 0x05e9
|
||||||
#define PRODUCT_PALM_CONNECT 0x0080
|
|
||||||
#define PRODUCT_KLSI_KL5KUSB105D 0x00c0
|
const usb_serial_device kKLSIDevices[] = {
|
||||||
|
{VENDOR_PALM, 0x0080, "PalmConnect RS232"},
|
||||||
|
{VENDOR_KLSI, 0x00c0, "KLSI KL5KUSB105D"}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* protocol defines */
|
/* protocol defines */
|
||||||
#define KLSI_SET_REQUEST 0x01
|
#define KLSI_SET_REQUEST 0x01
|
||||||
@@ -58,4 +64,5 @@ virtual void OnWrite(const char *buffer, size_t *numBytes,
|
|||||||
virtual void OnClose();
|
virtual void OnClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //_USB_KLSI_H_
|
#endif //_USB_KLSI_H_
|
||||||
|
|||||||
@@ -4,36 +4,43 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2003-2004 by Siarzhuk Zharski <imker@gmx.li>
|
* Copyright (c) 2003-2004 by Siarzhuk Zharski <imker@gmx.li>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||||
*/
|
*/
|
||||||
#ifndef _USB_PROLIFIC_H_
|
#ifndef _USB_PROLIFIC_H_
|
||||||
#define _USB_PROLIFIC_H_
|
#define _USB_PROLIFIC_H_
|
||||||
|
|
||||||
|
|
||||||
#include "ACM.h"
|
#include "ACM.h"
|
||||||
|
|
||||||
|
|
||||||
/* supported vendor and product ids */
|
/* supported vendor and product ids */
|
||||||
#define VENDOR_PROLIFIC 0x067b
|
#define VENDOR_PROLIFIC 0x067b
|
||||||
#define VENDOR_IODATA 0x04bb
|
|
||||||
#define VENDOR_ATEN 0x0557
|
#define VENDOR_ATEN 0x0557
|
||||||
#define VENDOR_TDK 0x04bf
|
|
||||||
#define VENDOR_RATOC 0x0584
|
|
||||||
#define VENDOR_ELECOM 0x056e
|
#define VENDOR_ELECOM 0x056e
|
||||||
#define VENDOR_SOURCENEXT 0x0833
|
#define VENDOR_HAL 0x0b41
|
||||||
#define VENDOR_HAL 0x0b41
|
#define VENDOR_IODATA 0x04bb
|
||||||
|
#define VENDOR_RATOC 0x0584
|
||||||
|
#define VENDOR_SOURCENEXT 0x0833
|
||||||
|
#define VENDOR_TDK 0x04bf
|
||||||
|
|
||||||
|
const usb_serial_device kProlificDevices[] = {
|
||||||
|
{VENDOR_PROLIFIC, 0x04bb, "PL2303 Serial adapter (IODATA USB-RSAQ2)"},
|
||||||
|
{VENDOR_PROLIFIC, 0x2303, "PL2303 Serial adapter (ATEN/IOGEAR UC232A)"},
|
||||||
|
{VENDOR_ATEN, 0x2008, "Aten Serial adapter"},
|
||||||
|
{VENDOR_ELECOM, 0x5003, "Elecom UC-SGT"},
|
||||||
|
{VENDOR_HAL, 0x0011, "HAL Corporation Crossam2+USB"},
|
||||||
|
{VENDOR_IODATA, 0x0a03, "I/O Data USB serial adapter USB-RSAQ1"},
|
||||||
|
{VENDOR_RATOC, 0xb000, "Ratoc USB serial adapter REX-USB60"},
|
||||||
|
{VENDOR_SOURCENEXT, 0x039f, "SOURCENEXT KeikaiDenwa 8"},
|
||||||
|
{VENDOR_SOURCENEXT, 0x039f, "SOURCENEXT KeikaiDenwa 8 with charger"},
|
||||||
|
{VENDOR_TDK, 0x0117, "TDK USB-PHS Adapter UHA6400"}
|
||||||
|
};
|
||||||
|
|
||||||
#define PRODUCT_IODATA_USBRSAQ 0x0a03
|
|
||||||
#define PRODUCT_PROLIFIC_RSAQ2 0x04bb
|
|
||||||
#define PRODUCT_ATEN_UC232A 0x2008
|
|
||||||
#define PRODUCT_PROLIFIC_PL2303 0x2303
|
|
||||||
#define PRODUCT_TDK_UHA6400 0x0117
|
|
||||||
#define PRODUCT_RATOC_REXUSB60 0xb000
|
|
||||||
#define PRODUCT_ELECOM_UCSGT 0x5003
|
|
||||||
#define PRODUCT_SOURCENEXT_KEIKAI8 0x039f
|
|
||||||
#define PRODUCT_SOURCENEXT_KEIKAI8_CHG 0x012e
|
|
||||||
#define PRODUCT_HAL_IMR001 0x0011
|
|
||||||
|
|
||||||
/* protocol defines */
|
/* protocol defines */
|
||||||
#define PROLIFIC_SET_REQUEST 0x01
|
#define PROLIFIC_SET_REQUEST 0x01
|
||||||
|
|
||||||
#define PROLIFIC_BUF_SIZE 256
|
#define PROLIFIC_BUF_SIZE 256
|
||||||
|
|
||||||
struct request_item;
|
struct request_item;
|
||||||
@@ -55,4 +62,5 @@ private:
|
|||||||
bool fIsHX;
|
bool fIsHX;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //_USB_PROLIFIC_H_
|
#endif //_USB_PROLIFIC_H_
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li>
|
* Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include "SerialDevice.h"
|
#include "SerialDevice.h"
|
||||||
@@ -714,451 +719,47 @@ SerialDevice *
|
|||||||
SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
|
SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
|
||||||
uint16 productID)
|
uint16 productID)
|
||||||
{
|
{
|
||||||
const char *description = NULL;
|
// FTDI Serial Device
|
||||||
|
for (uint32 i = 0; i < sizeof(kFTDIDevices)
|
||||||
switch (vendorID) {
|
/ sizeof(kFTDIDevices[0]); i++) {
|
||||||
case VENDOR_IODATA:
|
if (vendorID == kFTDIDevices[i].vendorID
|
||||||
case VENDOR_ATEN:
|
&& productID == kFTDIDevices[i].productID) {
|
||||||
case VENDOR_TDK:
|
return new(std::nothrow) FTDIDevice(device, vendorID, productID,
|
||||||
case VENDOR_RATOC:
|
kFTDIDevices[i].deviceName);
|
||||||
case VENDOR_PROLIFIC:
|
|
||||||
case VENDOR_ELECOM:
|
|
||||||
case VENDOR_SOURCENEXT:
|
|
||||||
case VENDOR_HAL:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case PRODUCT_PROLIFIC_RSAQ2:
|
|
||||||
description = "PL2303 Serial adapter (IODATA USB-RSAQ2)";
|
|
||||||
break;
|
|
||||||
case PRODUCT_IODATA_USBRSAQ:
|
|
||||||
description = "I/O Data USB serial adapter USB-RSAQ1";
|
|
||||||
break;
|
|
||||||
case PRODUCT_ATEN_UC232A:
|
|
||||||
description = "Aten Serial adapter";
|
|
||||||
break;
|
|
||||||
case PRODUCT_TDK_UHA6400:
|
|
||||||
description = "TDK USB-PHS Adapter UHA6400";
|
|
||||||
break;
|
|
||||||
case PRODUCT_RATOC_REXUSB60:
|
|
||||||
description = "Ratoc USB serial adapter REX-USB60";
|
|
||||||
break;
|
|
||||||
case PRODUCT_PROLIFIC_PL2303:
|
|
||||||
description = "PL2303 Serial adapter (ATEN/IOGEAR UC232A)";
|
|
||||||
break;
|
|
||||||
case PRODUCT_ELECOM_UCSGT:
|
|
||||||
description = "Elecom UC-SGT";
|
|
||||||
break;
|
|
||||||
case PRODUCT_SOURCENEXT_KEIKAI8:
|
|
||||||
description = "SOURCENEXT KeikaiDenwa 8";
|
|
||||||
break;
|
|
||||||
case PRODUCT_SOURCENEXT_KEIKAI8_CHG:
|
|
||||||
description = "SOURCENEXT KeikaiDenwa 8 with charger";
|
|
||||||
break;
|
|
||||||
case PRODUCT_HAL_IMR001:
|
|
||||||
description = "HAL Corporation Crossam2+USB";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
return new(std::nothrow) ProlificDevice(device, vendorID, productID,
|
|
||||||
description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case VENDOR_FTDI:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case PRODUCT_FTDI_8U100AX:
|
|
||||||
description = "FTDI 8U100AX serial converter";
|
|
||||||
break;
|
|
||||||
case PRODUCT_FTDI_8U232AM:
|
|
||||||
description = "FTDI 8U232AM serial converter";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
return new(std::nothrow) FTDIDevice(device, vendorID, productID,
|
|
||||||
description);
|
|
||||||
}
|
|
||||||
|
|
||||||
case VENDOR_PALM:
|
|
||||||
case VENDOR_KLSI:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case PRODUCT_PALM_CONNECT:
|
|
||||||
description = "PalmConnect RS232";
|
|
||||||
break;
|
|
||||||
case PRODUCT_KLSI_KL5KUSB105D:
|
|
||||||
description = "KLSI KL5KUSB105D";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
return new(std::nothrow) KLSIDevice(device, vendorID, productID,
|
|
||||||
description);
|
|
||||||
}
|
|
||||||
|
|
||||||
case VENDOR_RENESAS:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0053:
|
|
||||||
description = "Renesas RX610 RX-Stick";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_AKATOM:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x066A:
|
|
||||||
description = "AKTAKOM ACE-1001";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_PIRELLI:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xE000:
|
|
||||||
case 0xE003:
|
|
||||||
description = "Pirelli DP-L10 GSM Mobile";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_CYPHERLAB:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x1000:
|
|
||||||
description = "Cipherlab CCD Barcode Scanner";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_GEMALTO:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x5501:
|
|
||||||
description = "Gemalto contactless smartcard reader";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_DIGIANSWER:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x000A:
|
|
||||||
description = "Digianswer ZigBee MAC device";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_MEI:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x1100:
|
|
||||||
case 0x1101:
|
|
||||||
description = "MEI Acceptor";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_DYNASTREAM:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x1003:
|
|
||||||
case 0x1004:
|
|
||||||
case 0x1006:
|
|
||||||
description = "Dynastream ANT development board";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_KNOCKOFF:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xAA26:
|
|
||||||
description = "Knock-off DCU-11";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_SIEMENS:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x10C5:
|
|
||||||
description = "Siemens MC60";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_NOKIA:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xAC70:
|
|
||||||
description = "Nokia CA-42";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_SILICON:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0F91:
|
|
||||||
case 0x1101:
|
|
||||||
case 0x1601:
|
|
||||||
case 0x800A:
|
|
||||||
case 0x803B:
|
|
||||||
case 0x8044:
|
|
||||||
case 0x804E:
|
|
||||||
case 0x8053:
|
|
||||||
case 0x8054:
|
|
||||||
case 0x8066:
|
|
||||||
case 0x806F:
|
|
||||||
case 0x807A:
|
|
||||||
case 0x80CA:
|
|
||||||
case 0x80DD:
|
|
||||||
case 0x80F6:
|
|
||||||
case 0x8115:
|
|
||||||
case 0x813D:
|
|
||||||
case 0x813F:
|
|
||||||
case 0x814A:
|
|
||||||
case 0x814B:
|
|
||||||
case 0x8156:
|
|
||||||
case 0x815E:
|
|
||||||
case 0x818B:
|
|
||||||
case 0x819F:
|
|
||||||
case 0x81A6:
|
|
||||||
case 0x81AC:
|
|
||||||
case 0x81AD:
|
|
||||||
case 0x81C8:
|
|
||||||
case 0x81E2:
|
|
||||||
case 0x81E7:
|
|
||||||
case 0x81E8:
|
|
||||||
case 0x81F2:
|
|
||||||
case 0x8218:
|
|
||||||
case 0x822B:
|
|
||||||
case 0x826B:
|
|
||||||
case 0x8293:
|
|
||||||
case 0x82F9:
|
|
||||||
case 0x8341:
|
|
||||||
case 0x8382:
|
|
||||||
case 0x83A8:
|
|
||||||
case 0x83D8:
|
|
||||||
case 0x8411:
|
|
||||||
case 0x8418:
|
|
||||||
case 0x846E:
|
|
||||||
case 0x8477:
|
|
||||||
case 0x85EA:
|
|
||||||
case 0x85EB:
|
|
||||||
case 0x8664:
|
|
||||||
case 0x8665:
|
|
||||||
case 0xEA60:
|
|
||||||
case 0xEA61:
|
|
||||||
case 0xEA71:
|
|
||||||
case 0xF001:
|
|
||||||
case 0xF002:
|
|
||||||
case 0xF003:
|
|
||||||
case 0xF004:
|
|
||||||
description = "Silicon Labs CP210x USB UART converter";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_SILICON2:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xEA61:
|
|
||||||
description = "Silicon Labs GPRS USB Modem";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_SILICON3:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xEA6A:
|
|
||||||
description = "Silicon Labs GPRS USB Modem 100EU";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_BALTECH:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x9999:
|
|
||||||
description = "Balteck card reader";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_OWEN:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0004:
|
|
||||||
description = "Owen AC4 USB-RS485 Converter";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_CLIPSAL:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0303:
|
|
||||||
description = "Clipsal 5500PCU C-Bus USB interface";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_JABLOTRON:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0001:
|
|
||||||
description = "Jablotron serial interface";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_WIENER:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0010:
|
|
||||||
case 0x0011:
|
|
||||||
case 0x0012:
|
|
||||||
case 0x0015:
|
|
||||||
description = "W-IE-NE-R Plein & Baus GmbH device";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_WAVESENSE:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xAAAA:
|
|
||||||
description = "Wavesense Jazz blood glucose meter";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_VAISALA:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x0200:
|
|
||||||
description = "Vaisala USB instrument";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_ELV:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0xE00F:
|
|
||||||
description = "ELV USB I²C interface";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_WAGO:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x07A6:
|
|
||||||
description = "WAGO 750-923 USB Service";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VENDOR_DW700:
|
|
||||||
{
|
|
||||||
switch (productID) {
|
|
||||||
case 0x9500:
|
|
||||||
description = "DW700 GPS USB interface";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description != NULL)
|
|
||||||
goto SILICON;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
SILICON:
|
|
||||||
return new(std::nothrow) SiliconDevice(device, vendorID, productID,
|
|
||||||
description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KLSI Serial Device
|
||||||
|
for (uint32 i = 0; i < sizeof(kKLSIDevices)
|
||||||
|
/ sizeof(kKLSIDevices[0]); i++) {
|
||||||
|
if (vendorID == kKLSIDevices[i].vendorID
|
||||||
|
&& productID == kKLSIDevices[i].productID) {
|
||||||
|
return new(std::nothrow) KLSIDevice(device, vendorID, productID,
|
||||||
|
kKLSIDevices[i].deviceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prolific Serial Device
|
||||||
|
for (uint32 i = 0; i < sizeof(kProlificDevices)
|
||||||
|
/ sizeof(kProlificDevices[0]); i++) {
|
||||||
|
if (vendorID == kProlificDevices[i].vendorID
|
||||||
|
&& productID == kProlificDevices[i].productID) {
|
||||||
|
return new(std::nothrow) ProlificDevice(device, vendorID, productID,
|
||||||
|
kProlificDevices[i].deviceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Silicon Serial Device
|
||||||
|
for (uint32 i = 0; i < sizeof(kSiliconDevices)
|
||||||
|
/ sizeof(kSiliconDevices[0]); i++) {
|
||||||
|
if (vendorID == kSiliconDevices[i].vendorID
|
||||||
|
&& productID == kSiliconDevices[i].productID) {
|
||||||
|
return new(std::nothrow) SiliconDevice(device, vendorID, productID,
|
||||||
|
kSiliconDevices[i].deviceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, return standard ACM device
|
||||||
return new(std::nothrow) ACMDevice(device, vendorID, productID,
|
return new(std::nothrow) ACMDevice(device, vendorID, productID,
|
||||||
"CDC ACM compatible device");
|
"CDC ACM compatible device");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,24 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li>
|
* Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||||
*/
|
*/
|
||||||
#ifndef _USB_DEVICE_H_
|
#ifndef _USB_DEVICE_H_
|
||||||
#define _USB_DEVICE_H_
|
#define _USB_DEVICE_H_
|
||||||
|
|
||||||
|
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct usb_serial_device {
|
||||||
|
uint32 vendorID;
|
||||||
|
uint32 productID;
|
||||||
|
const char* deviceName;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SerialDevice {
|
class SerialDevice {
|
||||||
public:
|
public:
|
||||||
SerialDevice(usb_device device,
|
SerialDevice(usb_device device,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
* Copyright 2011, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,133 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
* Copyright 2011, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||||
*/
|
*/
|
||||||
#ifndef _USB_SILICON_H_
|
#ifndef _USB_SILICON_H_
|
||||||
#define _USB_SILICON_H_
|
#define _USB_SILICON_H_
|
||||||
|
|
||||||
|
|
||||||
#include "SerialDevice.h"
|
#include "SerialDevice.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* supported vendor and product ids */
|
||||||
|
#define VENDOR_RENESAS 0x045B
|
||||||
|
#define VENDOR_AKATOM 0x0471
|
||||||
|
#define VENDOR_PIRELLI 0x0489
|
||||||
|
#define VENDOR_CYPHERLAB 0x0745
|
||||||
|
#define VENDOR_GEMALTO 0x08E6
|
||||||
|
#define VENDOR_DIGIANSWER 0x08FD
|
||||||
|
#define VENDOR_MEI 0x0BED
|
||||||
|
#define VENDOR_DYNASTREAM 0x0FCF
|
||||||
|
#define VENDOR_KNOCKOFF 0x10A6
|
||||||
|
#define VENDOR_SIEMENS 0x10AB
|
||||||
|
#define VENDOR_NOKIA 0x10B5
|
||||||
|
#define VENDOR_SILICON 0x10C4
|
||||||
|
#define VENDOR_SILICON2 0x10C5
|
||||||
|
#define VENDOR_SILICON3 0x10CE
|
||||||
|
#define VENDOR_BALTECH 0x13AD
|
||||||
|
#define VENDOR_OWEN 0x1555
|
||||||
|
#define VENDOR_CLIPSAL 0x166A
|
||||||
|
#define VENDOR_JABLOTRON 0x16D6
|
||||||
|
#define VENDOR_WIENER 0x16DC
|
||||||
|
#define VENDOR_WAVESENSE 0x17F4
|
||||||
|
#define VENDOR_VAISALA 0x1843
|
||||||
|
#define VENDOR_ELV 0x18EF
|
||||||
|
#define VENDOR_WAGO 0x1BE3
|
||||||
|
#define VENDOR_DW700 0x413C
|
||||||
|
|
||||||
|
const usb_serial_device kSiliconDevices[] = {
|
||||||
|
{VENDOR_RENESAS, 0x0053, "Renesas RX610 RX-Stick"},
|
||||||
|
{VENDOR_AKATOM, 0x066A, "AKTAKOM ACE-1001"},
|
||||||
|
{VENDOR_PIRELLI, 0xE000, "Pirelli DP-L10 GSM Mobile"},
|
||||||
|
{VENDOR_PIRELLI, 0xE003, "Pirelli DP-L10 GSM Mobile"},
|
||||||
|
{VENDOR_CYPHERLAB, 0x1000, "Cipherlab CCD Barcode Scanner"},
|
||||||
|
{VENDOR_GEMALTO, 0x5501, "Gemalto contactless smartcard reader"},
|
||||||
|
{VENDOR_DIGIANSWER, 0x000A, "Digianswer ZigBee MAC device"},
|
||||||
|
{VENDOR_MEI, 0x1100, "MEI Acceptor"},
|
||||||
|
{VENDOR_MEI, 0x1101, "MEI Acceptor"},
|
||||||
|
{VENDOR_DYNASTREAM, 0x1003, "Dynastream ANT development board"},
|
||||||
|
{VENDOR_DYNASTREAM, 0x1004, "Dynastream ANT development board"},
|
||||||
|
{VENDOR_DYNASTREAM, 0x1006, "Dynastream ANT development board"},
|
||||||
|
{VENDOR_KNOCKOFF, 0xAA26, "Knock-off DCU-11"},
|
||||||
|
{VENDOR_SIEMENS, 0x10C5, "Siemens MC60"},
|
||||||
|
{VENDOR_NOKIA, 0xAC70, "Nokia CA-42"},
|
||||||
|
{VENDOR_BALTECH, 0x9999, "Balteck card reader"},
|
||||||
|
{VENDOR_OWEN, 0x0004, "Owen AC4 USB-RS485 Converter"},
|
||||||
|
{VENDOR_CLIPSAL, 0x0303, "Clipsal 5500PCU C-Bus USB interface"},
|
||||||
|
{VENDOR_JABLOTRON, 0x0001, "Jablotron serial interface"},
|
||||||
|
{VENDOR_WIENER, 0x0010, "W-IE-NE-R Plein & Baus GmbH device"},
|
||||||
|
{VENDOR_WIENER, 0x0011, "W-IE-NE-R Plein & Baus GmbH device"},
|
||||||
|
{VENDOR_WIENER, 0x0012, "W-IE-NE-R Plein & Baus GmbH device"},
|
||||||
|
{VENDOR_WIENER, 0x0015, "W-IE-NE-R Plein & Baus GmbH device"},
|
||||||
|
{VENDOR_WAVESENSE, 0xAAAA, "Wavesense Jazz blood glucose meter"},
|
||||||
|
{VENDOR_VAISALA, 0x0200, "Vaisala USB instrument"},
|
||||||
|
{VENDOR_ELV, 0xE00F, "ELV USB I²C interface"},
|
||||||
|
{VENDOR_WAGO, 0x07A6, "WAGO 750-923 USB Service"},
|
||||||
|
{VENDOR_DW700, 0x9500, "DW700 GPS USB interface"},
|
||||||
|
{VENDOR_SILICON, 0x0F91, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x1101, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x1601, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x800A, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x803B, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8044, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x804E, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8053, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8054, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8066, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x806F, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x807A, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x80CA, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x80DD, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x80F6, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8115, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x813D, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x813F, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x814A, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x814B, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8156, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x815E, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x818B, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x819F, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81A6, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81AC, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81AD, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81C8, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81E2, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81E7, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81E8, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x81F2, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8218, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x822B, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x826B, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8293, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x82F9, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8341, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8382, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x83A8, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x83D8, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8411, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8418, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x846E, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8477, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x85EA, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x85EB, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8664, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0x8665, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xEA60, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xEA61, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xEA71, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xF001, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xF002, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xF003, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON, 0xF004, "Silicon Labs CP210x USB UART converter"},
|
||||||
|
{VENDOR_SILICON2, 0xEA61, "Silicon Labs GPRS USB Modem"},
|
||||||
|
{VENDOR_SILICON3, 0xEA6A, "Silicon Labs GPRS USB Modem 100EU"}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SiliconDevice : public SerialDevice {
|
class SiliconDevice : public SerialDevice {
|
||||||
public:
|
public:
|
||||||
SiliconDevice(usb_device device, uint16 vendorID,
|
SiliconDevice(usb_device device, uint16 vendorID,
|
||||||
@@ -98,30 +219,5 @@ status_t WriteConfig(CP210XRequest request, uint16_t* data,
|
|||||||
size_t size);
|
size_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VENDOR_RENESAS 0x045B
|
|
||||||
#define VENDOR_AKATOM 0x0471
|
|
||||||
#define VENDOR_PIRELLI 0x0489
|
|
||||||
#define VENDOR_CYPHERLAB 0x0745
|
|
||||||
#define VENDOR_GEMALTO 0x08E6
|
|
||||||
#define VENDOR_DIGIANSWER 0x08FD
|
|
||||||
#define VENDOR_MEI 0x0BED
|
|
||||||
#define VENDOR_DYNASTREAM 0x0FCF
|
|
||||||
#define VENDOR_KNOCKOFF 0x10A6
|
|
||||||
#define VENDOR_SIEMENS 0x10AB
|
|
||||||
#define VENDOR_NOKIA 0x10B5
|
|
||||||
#define VENDOR_SILICON 0x10C4
|
|
||||||
#define VENDOR_SILICON2 0x10C5
|
|
||||||
#define VENDOR_SILICON3 0x10CE
|
|
||||||
#define VENDOR_BALTECH 0x13AD
|
|
||||||
#define VENDOR_OWEN 0x1555
|
|
||||||
#define VENDOR_CLIPSAL 0x166A
|
|
||||||
#define VENDOR_JABLOTRON 0x16D6
|
|
||||||
#define VENDOR_WIENER 0x16DC
|
|
||||||
#define VENDOR_WAVESENSE 0x17F4
|
|
||||||
#define VENDOR_VAISALA 0x1843
|
|
||||||
#define VENDOR_ELV 0x18EF
|
|
||||||
#define VENDOR_WAGO 0x1BE3
|
|
||||||
#define VENDOR_DW700 0x413C
|
|
||||||
|
|
||||||
|
|
||||||
#endif //_USB_SILICON_H_
|
#endif //_USB_SILICON_H_
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf,
|
|||||||
TRACE("fs_readdir - ENTER (sizeof(buf)=%d, bufsize=%d, num=%d\n",
|
TRACE("fs_readdir - ENTER (sizeof(buf)=%d, bufsize=%d, num=%d\n",
|
||||||
sizeof(buf), bufsize, *num);
|
sizeof(buf), bufsize, *num);
|
||||||
|
|
||||||
if (!ns || !node || !cookie || !num || bufsize < sizeof(buf)) {
|
if (!ns || !node || !cookie || !num || bufsize < sizeof(*buf)) {
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,8 +407,8 @@ SonixCamDevice::ReadIIC(uint8 address, uint8 *data)
|
|||||||
if (!Sensor())
|
if (!Sensor())
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
//dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4);
|
//dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4);
|
||||||
buffer[0] = (1 << 4) | Sensor()->Use400kHz()?0x01:0
|
buffer[0] = (1 << 4) | (Sensor()->Use400kHz()?0x01:0)
|
||||||
| Sensor()->UseRealIIC()?0x80:0;
|
| (Sensor()->UseRealIIC()?0x80:0);
|
||||||
buffer[1] = Sensor()->IICWriteAddress();
|
buffer[1] = Sensor()->IICWriteAddress();
|
||||||
buffer[2] = address;
|
buffer[2] = address;
|
||||||
buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */
|
buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */
|
||||||
@@ -421,8 +421,8 @@ SonixCamDevice::ReadIIC(uint8 address, uint8 *data)
|
|||||||
|
|
||||||
|
|
||||||
//dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4);
|
//dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4);
|
||||||
buffer[0] = (1 << 4) | Sensor()->Use400kHz()?0x01:0
|
buffer[0] = (1 << 4) | (Sensor()->Use400kHz()?0x01:0)
|
||||||
| 0x02 | Sensor()->UseRealIIC()?0x80:0; /* read 1 byte */
|
| 0x02 | (Sensor()->UseRealIIC()?0x80:0); /* read 1 byte */
|
||||||
buffer[1] = Sensor()->IICReadAddress();//IICWriteAddress
|
buffer[1] = Sensor()->IICReadAddress();//IICWriteAddress
|
||||||
buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */
|
buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */
|
||||||
err = WriteReg(SN9C102_I2C_SETUP, buffer, 8);
|
err = WriteReg(SN9C102_I2C_SETUP, buffer, 8);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
@@ -23,8 +24,6 @@
|
|||||||
#include <TimeSource.h>
|
#include <TimeSource.h>
|
||||||
#include <TranslationKit.h>
|
#include <TranslationKit.h>
|
||||||
|
|
||||||
#include <storage/FindDirectory.h>
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "CodyCam"
|
#define B_TRANSLATION_CONTEXT "CodyCam"
|
||||||
|
|
||||||
|
|||||||
+208
-74
@@ -56,7 +56,7 @@ static const char* kUsage =
|
|||||||
"\n"
|
"\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -h, --help - Print this usage info and exit.\n"
|
" -h, --help - Print this usage info and exit.\n"
|
||||||
" -c, --cli - Use command line user interface (not yet implemented)\n"
|
" -c, --cli - Use command line user interface\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +88,13 @@ struct Options {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct DebuggedProgramInfo {
|
||||||
|
team_id team;
|
||||||
|
thread_id thread;
|
||||||
|
bool stopInMain;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
parse_arguments(int argc, const char* const* argv, bool noOutput,
|
parse_arguments(int argc, const char* const* argv, bool noOutput,
|
||||||
Options& options)
|
Options& options)
|
||||||
@@ -174,25 +181,104 @@ parse_arguments(int argc, const char* const* argv, bool noOutput,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
global_init()
|
||||||
|
{
|
||||||
|
status_t error = TypeHandlerRoster::CreateDefault();
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
error = ValueHandlerRoster::CreateDefault();
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds or runs the program to debug, depending on the command line options.
|
||||||
|
* @param options The parsed command line options.
|
||||||
|
* @param _info The info for the program to fill in. Will only be filled in
|
||||||
|
* if successful.
|
||||||
|
* @return \c true, if the program has been found or ran.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
get_debugged_program(const Options& options, DebuggedProgramInfo& _info)
|
||||||
|
{
|
||||||
|
team_id team = options.team;
|
||||||
|
thread_id thread = options.thread;
|
||||||
|
bool stopInMain = false;
|
||||||
|
|
||||||
|
// If command line arguments were given, start the program.
|
||||||
|
if (options.commandLineArgc > 0) {
|
||||||
|
printf("loading program: \"%s\" ...\n", options.commandLineArgv[0]);
|
||||||
|
// TODO: What about the CWD?
|
||||||
|
thread = load_program(options.commandLineArgv,
|
||||||
|
options.commandLineArgc, false);
|
||||||
|
if (thread < 0) {
|
||||||
|
// TODO: Notify the user!
|
||||||
|
fprintf(stderr, "Error: Failed to load program \"%s\": %s\n",
|
||||||
|
options.commandLineArgv[0], strerror(thread));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
team = thread;
|
||||||
|
// main thread ID == team ID
|
||||||
|
stopInMain = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// no parameters given, prompt the user to attach to a team
|
||||||
|
if (team < 0 && thread < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// no team, but a thread -- get team
|
||||||
|
if (team < 0) {
|
||||||
|
printf("no team yet, getting thread info...\n");
|
||||||
|
thread_info threadInfo;
|
||||||
|
status_t error = get_thread_info(thread, &threadInfo);
|
||||||
|
if (error != B_OK) {
|
||||||
|
// TODO: Notify the user!
|
||||||
|
fprintf(stderr, "Error: Failed to get info for thread \"%ld\": "
|
||||||
|
"%s\n", thread, strerror(error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
team = threadInfo.team;
|
||||||
|
}
|
||||||
|
printf("team: %ld, thread: %ld\n", team, thread);
|
||||||
|
|
||||||
|
_info.team = team;
|
||||||
|
_info.thread = thread;
|
||||||
|
_info.stopInMain = stopInMain;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a TeamDebugger for the given team. If userInterface is given,
|
||||||
|
* that user interface is used (the caller retains its reference), otherwise
|
||||||
|
* a graphical user interface is created.
|
||||||
|
*/
|
||||||
static TeamDebugger*
|
static TeamDebugger*
|
||||||
start_team_debugger(team_id teamID, SettingsManager* settingsManager,
|
start_team_debugger(team_id teamID, SettingsManager* settingsManager,
|
||||||
TeamDebugger::Listener* listener, thread_id threadID = -1,
|
TeamDebugger::Listener* listener, thread_id threadID = -1,
|
||||||
bool stopInMain = false, bool useCLI = false)
|
bool stopInMain = false, UserInterface* userInterface = NULL)
|
||||||
{
|
{
|
||||||
if (teamID < 0)
|
if (teamID < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
UserInterface* userInterface = useCLI
|
BReference<UserInterface> userInterfaceReference;
|
||||||
? (UserInterface*)new(std::nothrow) CommandLineUserInterface
|
|
||||||
: (UserInterface*)new(std::nothrow) GraphicalUserInterface;
|
|
||||||
|
|
||||||
if (userInterface == NULL) {
|
if (userInterface == NULL) {
|
||||||
// TODO: Notify the user!
|
userInterface = new(std::nothrow) GraphicalUserInterface;
|
||||||
fprintf(stderr, "Error: Out of memory!\n");
|
if (userInterface == NULL) {
|
||||||
return NULL;
|
// TODO: Notify the user!
|
||||||
|
fprintf(stderr, "Error: Out of memory!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
userInterfaceReference.SetTo(userInterface, true);
|
||||||
}
|
}
|
||||||
BReference<UserInterface> userInterfaceReference(userInterface, true);
|
|
||||||
|
|
||||||
status_t error = B_NO_MEMORY;
|
status_t error = B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -213,6 +299,7 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager,
|
|||||||
return debugger;
|
return debugger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Debugger application class
|
// #pragma mark - Debugger application class
|
||||||
|
|
||||||
|
|
||||||
@@ -247,6 +334,26 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - CliDebugger
|
||||||
|
|
||||||
|
|
||||||
|
class CliDebugger : private TeamDebugger::Listener {
|
||||||
|
public:
|
||||||
|
CliDebugger();
|
||||||
|
~CliDebugger();
|
||||||
|
|
||||||
|
bool Run(const Options& options);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// TeamDebugger::Listener
|
||||||
|
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||||
|
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - Debugger application class
|
||||||
|
|
||||||
|
|
||||||
Debugger::Debugger()
|
Debugger::Debugger()
|
||||||
:
|
:
|
||||||
BApplication(kDebuggerSignature),
|
BApplication(kDebuggerSignature),
|
||||||
@@ -266,11 +373,7 @@ Debugger::~Debugger()
|
|||||||
status_t
|
status_t
|
||||||
Debugger::Init()
|
Debugger::Init()
|
||||||
{
|
{
|
||||||
status_t error = TypeHandlerRoster::CreateDefault();
|
status_t error = global_init();
|
||||||
if (error != B_OK)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
error = ValueHandlerRoster::CreateDefault();
|
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@@ -348,62 +451,22 @@ Debugger::ArgvReceived(int32 argc, char** argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
team_id team = options.team;
|
DebuggedProgramInfo programInfo;
|
||||||
thread_id thread = options.thread;
|
if (!get_debugged_program(options, programInfo))
|
||||||
bool stopInMain = false;
|
|
||||||
|
|
||||||
// If command line arguments were given, start the program.
|
|
||||||
if (options.commandLineArgc > 0) {
|
|
||||||
printf("loading program: \"%s\" ...\n", options.commandLineArgv[0]);
|
|
||||||
// TODO: What about the CWD?
|
|
||||||
thread = load_program(options.commandLineArgv,
|
|
||||||
options.commandLineArgc, false);
|
|
||||||
if (thread < 0) {
|
|
||||||
// TODO: Notify the user!
|
|
||||||
fprintf(stderr, "Error: Failed to load program \"%s\": %s\n",
|
|
||||||
options.commandLineArgv[0], strerror(thread));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
team = thread;
|
|
||||||
// main thread ID == team ID
|
|
||||||
stopInMain = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no parameters given, prompt the user to attach to a team
|
|
||||||
if (team < 0 && thread < 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If we've got
|
TeamDebugger* debugger = _FindTeamDebugger(programInfo.team);
|
||||||
if (team < 0) {
|
|
||||||
printf("no team yet, getting thread info...\n");
|
|
||||||
thread_info threadInfo;
|
|
||||||
status_t error = get_thread_info(thread, &threadInfo);
|
|
||||||
if (error != B_OK) {
|
|
||||||
// TODO: Notify the user!
|
|
||||||
fprintf(stderr, "Error: Failed to get info for thread \"%ld\": "
|
|
||||||
"%s\n", thread, strerror(error));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
team = threadInfo.team;
|
|
||||||
}
|
|
||||||
printf("team: %ld, thread: %ld\n", team, thread);
|
|
||||||
|
|
||||||
TeamDebugger* debugger = _FindTeamDebugger(team);
|
|
||||||
if (debugger != NULL) {
|
if (debugger != NULL) {
|
||||||
printf("There's already a debugger for team: %ld\n", team);
|
printf("There's already a debugger for team: %ld\n", programInfo.team);
|
||||||
debugger->Activate();
|
debugger->Activate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
start_team_debugger(team, &fSettingsManager, this, thread, stopInMain);
|
start_team_debugger(programInfo.team, &fSettingsManager, this,
|
||||||
|
programInfo.thread, programInfo.stopInMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TeamDebugger::Listener
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Debugger::TeamDebuggerStarted(TeamDebugger* debugger)
|
Debugger::TeamDebuggerStarted(TeamDebugger* debugger)
|
||||||
{
|
{
|
||||||
@@ -479,8 +542,79 @@ Debugger::_FindTeamDebugger(team_id teamID) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - CliDebugger
|
||||||
|
|
||||||
|
|
||||||
|
CliDebugger::CliDebugger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CliDebugger::~CliDebugger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
CliDebugger::Run(const Options& options)
|
||||||
|
{
|
||||||
|
// initialize global objects and settings manager
|
||||||
|
status_t error = global_init();
|
||||||
|
if (error != B_OK) {
|
||||||
|
fprintf(stderr, "Error: Global initialization failed: %s\n",
|
||||||
|
strerror(error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsManager settingsManager;
|
||||||
|
error = settingsManager.Init();
|
||||||
|
if (error != B_OK) {
|
||||||
|
fprintf(stderr, "Error: Settings manager initialization failed: "
|
||||||
|
"%s\n", strerror(error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the command line UI
|
||||||
|
CommandLineUserInterface* userInterface
|
||||||
|
= new(std::nothrow) CommandLineUserInterface;
|
||||||
|
if (userInterface == NULL) {
|
||||||
|
fprintf(stderr, "Error: Out of memory!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
BReference<UserInterface> userInterfaceReference(userInterface, true);
|
||||||
|
|
||||||
|
// get/run the program to be debugged and start the team debugger
|
||||||
|
DebuggedProgramInfo programInfo;
|
||||||
|
if (!get_debugged_program(options, programInfo))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (start_team_debugger(programInfo.team, &settingsManager, this,
|
||||||
|
programInfo.thread, programInfo.stopInMain, userInterface)
|
||||||
|
== NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
userInterface->Run();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CliDebugger::TeamDebuggerStarted(TeamDebugger* debugger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CliDebugger::TeamDebuggerQuit(TeamDebugger* debugger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, const char* const* argv)
|
main(int argc, const char* const* argv)
|
||||||
{
|
{
|
||||||
@@ -494,19 +628,19 @@ main(int argc, const char* const* argv)
|
|||||||
parse_arguments(argc, argv, false, options);
|
parse_arguments(argc, argv, false, options);
|
||||||
|
|
||||||
if (options.useCLI) {
|
if (options.useCLI) {
|
||||||
// TODO: implement
|
CliDebugger debugger;
|
||||||
fprintf(stderr, "Error: Command line interface unimplemented\n");
|
return debugger.Run(options) ? 0 : 1;
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
Debugger app;
|
|
||||||
status_t error = app.Init();
|
|
||||||
if (error != B_OK) {
|
|
||||||
fprintf(stderr, "Error: Failed to init application: %s\n",
|
|
||||||
strerror(error));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debugger app;
|
||||||
|
status_t error = app.Init();
|
||||||
|
if (error != B_OK) {
|
||||||
|
fprintf(stderr, "Error: Failed to init application: %s\n",
|
||||||
|
strerror(error));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,12 +169,13 @@ Application Debugger :
|
|||||||
# user_interface
|
# user_interface
|
||||||
UserInterface.cpp
|
UserInterface.cpp
|
||||||
|
|
||||||
|
# user_interface/cli
|
||||||
|
CliCommand.cpp
|
||||||
|
CommandLineUserInterface.cpp
|
||||||
|
|
||||||
# user_interface/gui
|
# user_interface/gui
|
||||||
GraphicalUserInterface.cpp
|
GraphicalUserInterface.cpp
|
||||||
|
|
||||||
# user_interface/cli
|
|
||||||
CommandLineUserInterface.cpp
|
|
||||||
|
|
||||||
# user_interface/gui/model
|
# user_interface/gui/model
|
||||||
VariablesViewState.cpp
|
VariablesViewState.cpp
|
||||||
VariablesViewStateHistory.cpp
|
VariablesViewStateHistory.cpp
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "CliCommand.h"
|
||||||
|
|
||||||
|
|
||||||
|
CliCommand::CliCommand(const char* summary, const char* usage)
|
||||||
|
:
|
||||||
|
fSummary(summary),
|
||||||
|
fUsage(usage)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CliCommand::~CliCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef CLI_COMMAND_H
|
||||||
|
#define CLI_COMMAND_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Referenceable.h>
|
||||||
|
|
||||||
|
|
||||||
|
class CliContext;
|
||||||
|
|
||||||
|
|
||||||
|
class CliCommand : public BReferenceable {
|
||||||
|
public:
|
||||||
|
CliCommand(const char* summary,
|
||||||
|
const char* usage);
|
||||||
|
virtual ~CliCommand();
|
||||||
|
|
||||||
|
const char* Summary() const { return fSummary; }
|
||||||
|
const char* Usage() const { return fUsage; }
|
||||||
|
|
||||||
|
virtual void Execute(int argc, const char* const* argv,
|
||||||
|
CliContext& context) = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* fSummary;
|
||||||
|
const char* fUsage;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CLI_COMMAND_H
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef CLI_CONTEXT_H
|
||||||
|
#define CLI_CONTEXT_H
|
||||||
|
|
||||||
|
|
||||||
|
class CliContext {
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CLI_CONTEXT_H
|
||||||
@@ -1,19 +1,115 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||||
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CommandLineUserInterface.h"
|
#include "CommandLineUserInterface.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <ArgumentVector.h>
|
||||||
|
#include <Referenceable.h>
|
||||||
|
|
||||||
|
#include "CliCommand.h"
|
||||||
|
#include "CliContext.h"
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - CommandEntry
|
||||||
|
|
||||||
|
|
||||||
|
struct CommandLineUserInterface::CommandEntry {
|
||||||
|
CommandEntry(const BString& name, CliCommand* command)
|
||||||
|
:
|
||||||
|
fName(name),
|
||||||
|
fCommand(command)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const BString& Name() const
|
||||||
|
{
|
||||||
|
return fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
CliCommand* Command() const
|
||||||
|
{
|
||||||
|
return fCommand.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString fName;
|
||||||
|
BReference<CliCommand> fCommand;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - HelpCommand
|
||||||
|
|
||||||
|
|
||||||
|
struct CommandLineUserInterface::HelpCommand : CliCommand {
|
||||||
|
HelpCommand(CommandLineUserInterface* userInterface)
|
||||||
|
:
|
||||||
|
CliCommand("print a list of all commands",
|
||||||
|
"%s\n"
|
||||||
|
"Prints a list of all commands."),
|
||||||
|
fUserInterface(userInterface)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Execute(int argc, const char* const* argv, CliContext& context)
|
||||||
|
{
|
||||||
|
fUserInterface->_PrintHelp();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CommandLineUserInterface* fUserInterface;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - HelpCommand
|
||||||
|
|
||||||
|
|
||||||
|
struct CommandLineUserInterface::QuitCommand : CliCommand {
|
||||||
|
QuitCommand(CommandLineUserInterface* userInterface)
|
||||||
|
:
|
||||||
|
CliCommand("quit Debugger",
|
||||||
|
"%s\n"
|
||||||
|
"Quits Debugger."),
|
||||||
|
fUserInterface(userInterface)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Execute(int argc, const char* const* argv, CliContext& context)
|
||||||
|
{
|
||||||
|
fUserInterface->fListener->UserInterfaceQuitRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CommandLineUserInterface* fUserInterface;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - CommandLineUserInterface
|
||||||
|
|
||||||
|
|
||||||
CommandLineUserInterface::CommandLineUserInterface()
|
CommandLineUserInterface::CommandLineUserInterface()
|
||||||
|
:
|
||||||
|
fTeam(NULL),
|
||||||
|
fListener(NULL),
|
||||||
|
fCommands(20, true),
|
||||||
|
fShowSemaphore(-1),
|
||||||
|
fShown(false),
|
||||||
|
fTerminating(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CommandLineUserInterface::~CommandLineUserInterface()
|
CommandLineUserInterface::~CommandLineUserInterface()
|
||||||
{
|
{
|
||||||
|
if (fShowSemaphore >= 0)
|
||||||
|
delete_sem(fShowSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27,33 +123,59 @@ CommandLineUserInterface::ID() const
|
|||||||
status_t
|
status_t
|
||||||
CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
||||||
{
|
{
|
||||||
return B_UNSUPPORTED;
|
fTeam = team;
|
||||||
|
fListener = listener;
|
||||||
|
|
||||||
|
status_t error = _RegisterCommands();
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
fShowSemaphore = create_sem(0, "show CLI");
|
||||||
|
if (fShowSemaphore < 0)
|
||||||
|
return fShowSemaphore;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CommandLineUserInterface::Show()
|
CommandLineUserInterface::Show()
|
||||||
{
|
{
|
||||||
|
fShown = true;
|
||||||
|
release_sem(fShowSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CommandLineUserInterface::Terminate()
|
CommandLineUserInterface::Terminate()
|
||||||
{
|
{
|
||||||
|
fTerminating = true;
|
||||||
|
|
||||||
|
if (fShown) {
|
||||||
|
// TODO: Signal the thread so it wakes up!
|
||||||
|
|
||||||
|
// Wait for input loop to finish.
|
||||||
|
while (acquire_sem(fShowSemaphore) == B_INTERRUPTED) {
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// The main thread will still be blocked in Run(). Unblock it.
|
||||||
|
delete_sem(fShowSemaphore);
|
||||||
|
fShowSemaphore = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CommandLineUserInterface::LoadSettings(const TeamUISettings* settings)
|
CommandLineUserInterface::LoadSettings(const TeamUISettings* settings)
|
||||||
{
|
{
|
||||||
return B_UNSUPPORTED;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CommandLineUserInterface::SaveSettings(TeamUISettings*& settings) const
|
CommandLineUserInterface::SaveSettings(TeamUISettings*& settings) const
|
||||||
{
|
{
|
||||||
return B_UNSUPPORTED;;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,3 +193,144 @@ CommandLineUserInterface::SynchronouslyAskUser(const char* title,
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandLineUserInterface::Run()
|
||||||
|
{
|
||||||
|
// Wait for the Show() semaphore to be released.
|
||||||
|
status_t error;
|
||||||
|
do {
|
||||||
|
error = acquire_sem(fShowSemaphore);
|
||||||
|
} while (error == B_INTERRUPTED);
|
||||||
|
|
||||||
|
if (error != B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_InputLoop();
|
||||||
|
|
||||||
|
// Release the Show() semaphore to signal Terminate().
|
||||||
|
release_sem(fShowSemaphore);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ status_t
|
||||||
|
CommandLineUserInterface::_InputLoopEntry(void* data)
|
||||||
|
{
|
||||||
|
return ((CommandLineUserInterface*)data)->_InputLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
CommandLineUserInterface::_InputLoop()
|
||||||
|
{
|
||||||
|
while (!fTerminating) {
|
||||||
|
// read a command line
|
||||||
|
printf("debugger> ");
|
||||||
|
fflush(stdout);
|
||||||
|
char buffer[256];
|
||||||
|
if (fgets(buffer, sizeof(buffer), stdin) == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// parse the command line
|
||||||
|
ArgumentVector args;
|
||||||
|
const char* parseErrorLocation;
|
||||||
|
switch (args.Parse(buffer, &parseErrorLocation)) {
|
||||||
|
case ArgumentVector::NO_ERROR:
|
||||||
|
break;
|
||||||
|
case ArgumentVector::NO_MEMORY:
|
||||||
|
printf("Insufficient memory parsing the command line.\n");
|
||||||
|
continue;
|
||||||
|
case ArgumentVector::UNTERMINATED_QUOTED_STRING:
|
||||||
|
printf("Parse error: Unterminated quoted string starting at "
|
||||||
|
"character %zu.\n", parseErrorLocation - buffer + 1);
|
||||||
|
continue;
|
||||||
|
case ArgumentVector::TRAILING_BACKSPACE:
|
||||||
|
printf("Parse error: trailing backspace.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.ArgumentCount() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_ExecuteCommand(args.ArgumentCount(), args.Arguments());
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
CommandLineUserInterface::_RegisterCommands()
|
||||||
|
{
|
||||||
|
if (_RegisterCommand("help", new(std::nothrow) HelpCommand(this)) &&
|
||||||
|
_RegisterCommand("quit", new(std::nothrow) QuitCommand(this))) {
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
CommandLineUserInterface::_RegisterCommand(const BString& name,
|
||||||
|
CliCommand* command)
|
||||||
|
{
|
||||||
|
BReference<CliCommand> commandReference(command, true);
|
||||||
|
if (name.IsEmpty() || command == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CommandEntry* entry = new(std::nothrow) CommandEntry(name, command);
|
||||||
|
if (entry == NULL || !fCommands.AddItem(entry)) {
|
||||||
|
delete entry;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandLineUserInterface::_ExecuteCommand(int argc, const char* const* argv)
|
||||||
|
{
|
||||||
|
const char* commandName = argv[0];
|
||||||
|
size_t commandNameLength = strlen(commandName);
|
||||||
|
|
||||||
|
CommandEntry* firstEntry = NULL;
|
||||||
|
for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) {
|
||||||
|
if (entry->Name().Compare(commandName, commandNameLength) == 0) {
|
||||||
|
if (firstEntry != NULL) {
|
||||||
|
printf("Ambiguous command \"%s\".\n", commandName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstEntry = entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstEntry == NULL) {
|
||||||
|
printf("Unknown command \"%s\".\n", commandName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CliContext context;
|
||||||
|
firstEntry->Command()->Execute(argc, argv, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CommandLineUserInterface::_PrintHelp()
|
||||||
|
{
|
||||||
|
// determine longest command name
|
||||||
|
int32 longestCommandName = 0;
|
||||||
|
for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) {
|
||||||
|
longestCommandName
|
||||||
|
= std::max(longestCommandName, entry->Name().Length());
|
||||||
|
}
|
||||||
|
|
||||||
|
// print the command list
|
||||||
|
for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) {
|
||||||
|
printf("%*s - %s\n", (int)longestCommandName, entry->Name().String(),
|
||||||
|
entry->Command()->Summary());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||||
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef COMMAND_LINE_USER_INTERFACE_H
|
#ifndef COMMAND_LINE_USER_INTERFACE_H
|
||||||
#define COMMAND_LINE_USER_INTERFACE_H
|
#define COMMAND_LINE_USER_INTERFACE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <ObjectList.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CliCommand;
|
||||||
|
|
||||||
|
|
||||||
class CommandLineUserInterface : public UserInterface {
|
class CommandLineUserInterface : public UserInterface {
|
||||||
public:
|
public:
|
||||||
CommandLineUserInterface();
|
CommandLineUserInterface();
|
||||||
@@ -33,6 +40,40 @@ public:
|
|||||||
const char* message, const char* choice1,
|
const char* message, const char* choice1,
|
||||||
const char* choice2, const char* choice3);
|
const char* choice2, const char* choice3);
|
||||||
|
|
||||||
|
void Run();
|
||||||
|
// Called by the main thread, when
|
||||||
|
// everything has been set up. Enters the
|
||||||
|
// input loop.
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct CommandEntry;
|
||||||
|
typedef BObjectList<CommandEntry> CommandList;
|
||||||
|
|
||||||
|
struct HelpCommand;
|
||||||
|
struct QuitCommand;
|
||||||
|
|
||||||
|
// GCC 2 support
|
||||||
|
friend struct HelpCommand;
|
||||||
|
friend struct QuitCommand;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static status_t _InputLoopEntry(void* data);
|
||||||
|
status_t _InputLoop();
|
||||||
|
|
||||||
|
status_t _RegisterCommands();
|
||||||
|
bool _RegisterCommand(const BString& name,
|
||||||
|
CliCommand* command);
|
||||||
|
void _ExecuteCommand(int argc,
|
||||||
|
const char* const* argv);
|
||||||
|
void _PrintHelp();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Team* fTeam;
|
||||||
|
UserInterfaceListener* fListener;
|
||||||
|
CommandList fCommands;
|
||||||
|
sem_id fShowSemaphore;
|
||||||
|
bool fShown;
|
||||||
|
bool fTerminating;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -118,9 +118,6 @@ private:
|
|||||||
BPoint fScrollOffsetStart;
|
BPoint fScrollOffsetStart;
|
||||||
|
|
||||||
uint32 fMouseFilterMode;
|
uint32 fMouseFilterMode;
|
||||||
|
|
||||||
BBitmap* fOffsreenBitmap;
|
|
||||||
BView* fOffsreenView;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CANVAS_VIEW_H
|
#endif // CANVAS_VIEW_H
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <IconEditorProtocol.h>
|
#include <IconEditorProtocol.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <storage/FindDirectory.h>
|
|
||||||
|
|
||||||
#include "support_settings.h"
|
#include "support_settings.h"
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ IconEditorApp::_LastFilePath(path_kind which)
|
|||||||
path = fLastOpenPath.String();
|
path = fLastOpenPath.String();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!path) {
|
if (path == NULL) {
|
||||||
|
|
||||||
BPath homePath;
|
BPath homePath;
|
||||||
if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK)
|
if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK)
|
||||||
@@ -372,7 +372,11 @@ IconEditorApp::_RestoreSettings()
|
|||||||
// Compensate offset for next window...
|
// Compensate offset for next window...
|
||||||
fLastWindowFrame.OffsetBy(-kWindowOffset, -kWindowOffset);
|
fLastWindowFrame.OffsetBy(-kWindowOffset, -kWindowOffset);
|
||||||
}
|
}
|
||||||
settings.FindMessage("window settings", &fLastWindowSettings);
|
BMessage lastSettings;
|
||||||
|
if (settings.FindMessage("window settings", &lastSettings)
|
||||||
|
== B_OK) {
|
||||||
|
fLastWindowSettings = lastSettings;
|
||||||
|
}
|
||||||
|
|
||||||
int32 mode;
|
int32 mode;
|
||||||
if (settings.FindInt32("export mode", &mode) >= B_OK)
|
if (settings.FindInt32("export mode", &mode) >= B_OK)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
@@ -31,8 +32,6 @@
|
|||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
|
||||||
#include <storage/FindDirectory.h>
|
|
||||||
|
|
||||||
#include "MediaFileInfoView.h"
|
#include "MediaFileInfoView.h"
|
||||||
#include "MediaFileListView.h"
|
#include "MediaFileListView.h"
|
||||||
#include "MessageConstants.h"
|
#include "MessageConstants.h"
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ TabContainerView::MouseDown(BPoint where)
|
|||||||
// Middle click outside tabs should always open a new tab.
|
// Middle click outside tabs should always open a new tab.
|
||||||
fClickCount = 2;
|
fClickCount = 2;
|
||||||
} else if (clicks > 1)
|
} else if (clicks > 1)
|
||||||
fClickCount = fClickCount++;
|
fClickCount++;
|
||||||
else
|
else
|
||||||
fClickCount = 1;
|
fClickCount = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -728,9 +728,10 @@ BColumnListView::BColumnListView(BRect rect, const char* name,
|
|||||||
fSelectionMessage(NULL),
|
fSelectionMessage(NULL),
|
||||||
fSortingEnabled(true),
|
fSortingEnabled(true),
|
||||||
fLatchWidth(kLatchWidth),
|
fLatchWidth(kLatchWidth),
|
||||||
fBorderStyle(border)
|
fBorderStyle(border),
|
||||||
|
fShowingHorizontalScrollBar(showHorizontalScrollbar)
|
||||||
{
|
{
|
||||||
_Init(showHorizontalScrollbar);
|
_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -742,9 +743,10 @@ BColumnListView::BColumnListView(const char* name, uint32 flags,
|
|||||||
fSelectionMessage(NULL),
|
fSelectionMessage(NULL),
|
||||||
fSortingEnabled(true),
|
fSortingEnabled(true),
|
||||||
fLatchWidth(kLatchWidth),
|
fLatchWidth(kLatchWidth),
|
||||||
fBorderStyle(border)
|
fBorderStyle(border),
|
||||||
|
fShowingHorizontalScrollBar(showHorizontalScrollbar)
|
||||||
{
|
{
|
||||||
_Init(showHorizontalScrollbar);
|
_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1857,8 +1859,8 @@ BColumnListView::PreferredSize()
|
|||||||
BRect outlineRect;
|
BRect outlineRect;
|
||||||
BRect vScrollBarRect;
|
BRect vScrollBarRect;
|
||||||
BRect hScrollBarRect;
|
BRect hScrollBarRect;
|
||||||
_GetChildViewRects(Bounds(), !fHorizontalScrollBar->IsHidden(),
|
_GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect,
|
||||||
titleRect, outlineRect, vScrollBarRect, hScrollBarRect);
|
hScrollBarRect);
|
||||||
// Start with the extra width for border and scrollbars etc.
|
// Start with the extra width for border and scrollbars etc.
|
||||||
size.width = titleRect.left - Bounds().left;
|
size.width = titleRect.left - Bounds().left;
|
||||||
size.width += Bounds().right - titleRect.right;
|
size.width += Bounds().right - titleRect.right;
|
||||||
@@ -1901,8 +1903,8 @@ BColumnListView::DoLayout()
|
|||||||
BRect outlineRect;
|
BRect outlineRect;
|
||||||
BRect vScrollBarRect;
|
BRect vScrollBarRect;
|
||||||
BRect hScrollBarRect;
|
BRect hScrollBarRect;
|
||||||
_GetChildViewRects(Bounds(), !fHorizontalScrollBar->IsHidden(),
|
_GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect,
|
||||||
titleRect, outlineRect, vScrollBarRect, hScrollBarRect);
|
hScrollBarRect);
|
||||||
|
|
||||||
fTitleView->MoveTo(titleRect.LeftTop());
|
fTitleView->MoveTo(titleRect.LeftTop());
|
||||||
fTitleView->ResizeTo(titleRect.Width(), titleRect.Height());
|
fTitleView->ResizeTo(titleRect.Width(), titleRect.Height());
|
||||||
@@ -1923,7 +1925,7 @@ BColumnListView::DoLayout()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BColumnListView::_Init(bool showHorizontalScrollbar)
|
BColumnListView::_Init()
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||||
|
|
||||||
@@ -1940,8 +1942,8 @@ BColumnListView::_Init(bool showHorizontalScrollbar)
|
|||||||
BRect outlineRect;
|
BRect outlineRect;
|
||||||
BRect vScrollBarRect;
|
BRect vScrollBarRect;
|
||||||
BRect hScrollBarRect;
|
BRect hScrollBarRect;
|
||||||
_GetChildViewRects(bounds, showHorizontalScrollbar, titleRect, outlineRect,
|
_GetChildViewRects(bounds, titleRect, outlineRect, vScrollBarRect,
|
||||||
vScrollBarRect, hScrollBarRect);
|
hScrollBarRect);
|
||||||
|
|
||||||
fOutlineView = new OutlineView(outlineRect, &fColumns, &fSortColumns, this);
|
fOutlineView = new OutlineView(outlineRect, &fColumns, &fSortColumns, this);
|
||||||
AddChild(fOutlineView);
|
AddChild(fOutlineView);
|
||||||
@@ -1959,7 +1961,7 @@ BColumnListView::_Init(bool showHorizontalScrollbar)
|
|||||||
"horizontal_scroll_bar", fTitleView, 0.0, bounds.Width(), B_HORIZONTAL);
|
"horizontal_scroll_bar", fTitleView, 0.0, bounds.Width(), B_HORIZONTAL);
|
||||||
AddChild(fHorizontalScrollBar);
|
AddChild(fHorizontalScrollBar);
|
||||||
|
|
||||||
if (!showHorizontalScrollbar)
|
if (!fShowingHorizontalScrollBar)
|
||||||
fHorizontalScrollBar->Hide();
|
fHorizontalScrollBar->Hide();
|
||||||
|
|
||||||
fOutlineView->FixScrollBar(true);
|
fOutlineView->FixScrollBar(true);
|
||||||
@@ -1967,9 +1969,8 @@ BColumnListView::_Init(bool showHorizontalScrollbar)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BColumnListView::_GetChildViewRects(const BRect& bounds,
|
BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect,
|
||||||
bool showHorizontalScrollbar, BRect& titleRect, BRect& outlineRect,
|
BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect)
|
||||||
BRect& vScrollBarRect, BRect& hScrollBarRect)
|
|
||||||
{
|
{
|
||||||
titleRect = bounds;
|
titleRect = bounds;
|
||||||
titleRect.bottom = titleRect.top + kTitleHeight;
|
titleRect.bottom = titleRect.top + kTitleHeight;
|
||||||
@@ -1980,7 +1981,7 @@ BColumnListView::_GetChildViewRects(const BRect& bounds,
|
|||||||
outlineRect = bounds;
|
outlineRect = bounds;
|
||||||
outlineRect.top = titleRect.bottom + 1.0;
|
outlineRect.top = titleRect.bottom + 1.0;
|
||||||
outlineRect.right -= B_V_SCROLL_BAR_WIDTH;
|
outlineRect.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
if (showHorizontalScrollbar)
|
if (fShowingHorizontalScrollBar)
|
||||||
outlineRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
outlineRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
|
||||||
vScrollBarRect = bounds;
|
vScrollBarRect = bounds;
|
||||||
@@ -1989,7 +1990,7 @@ BColumnListView::_GetChildViewRects(const BRect& bounds,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
vScrollBarRect.left = vScrollBarRect.right - B_V_SCROLL_BAR_WIDTH;
|
vScrollBarRect.left = vScrollBarRect.right - B_V_SCROLL_BAR_WIDTH;
|
||||||
if (showHorizontalScrollbar)
|
if (fShowingHorizontalScrollBar)
|
||||||
vScrollBarRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
vScrollBarRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
|
||||||
hScrollBarRect = bounds;
|
hScrollBarRect = bounds;
|
||||||
|
|||||||
@@ -361,8 +361,11 @@ BSoundFile::_ref_to_file(const entry_ref *ref)
|
|||||||
raw = &mf.u.raw_audio;
|
raw = &mf.u.raw_audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw == NULL)
|
if (raw == NULL) {
|
||||||
|
delete media;
|
||||||
|
delete file;
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
fSamplingRate = (int)raw->frame_rate;
|
fSamplingRate = (int)raw->frame_rate;
|
||||||
fChannelCount = raw->channel_count;
|
fChannelCount = raw->channel_count;
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ArgumentVector.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
struct ArgumentVector::Parser {
|
||||||
|
ParseError Parse(const char* commandLine, const char*& _errorLocation)
|
||||||
|
{
|
||||||
|
// init temporary arg/argv storage
|
||||||
|
fCurrentArg.clear();
|
||||||
|
fCurrentArgStarted = false;
|
||||||
|
fArgVector.clear();
|
||||||
|
fTotalStringSize = 0;
|
||||||
|
|
||||||
|
for (; *commandLine; commandLine++) {
|
||||||
|
char c = *commandLine;
|
||||||
|
|
||||||
|
// whitespace delimits args and is otherwise ignored
|
||||||
|
if (isspace(c)) {
|
||||||
|
_PushCurrentArg();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* errorBase = commandLine;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case '\'':
|
||||||
|
// quoted string -- no quoting
|
||||||
|
while (*++commandLine != '\'') {
|
||||||
|
c = *commandLine;
|
||||||
|
if (c == '\0') {
|
||||||
|
_errorLocation = errorBase;
|
||||||
|
return UNTERMINATED_QUOTED_STRING;
|
||||||
|
}
|
||||||
|
_PushCharacter(c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
// quoted string -- some quoting
|
||||||
|
while (*++commandLine != '"') {
|
||||||
|
c = *commandLine;
|
||||||
|
if (c == '\0') {
|
||||||
|
_errorLocation = errorBase;
|
||||||
|
return UNTERMINATED_QUOTED_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == '\\') {
|
||||||
|
c = *++commandLine;
|
||||||
|
if (c == '\0') {
|
||||||
|
_errorLocation = errorBase;
|
||||||
|
return UNTERMINATED_QUOTED_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only '\' and '"' can be quoted, otherwise the
|
||||||
|
// the '\' is treated as a normal char
|
||||||
|
if (c != '\\' && c != '"')
|
||||||
|
_PushCharacter('\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
_PushCharacter(c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
// quoted char
|
||||||
|
c = *++commandLine;
|
||||||
|
if (c == '\0') {
|
||||||
|
_errorLocation = errorBase;
|
||||||
|
return TRAILING_BACKSPACE;
|
||||||
|
}
|
||||||
|
_PushCharacter(c);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// normal char
|
||||||
|
_PushCharacter(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// commit last arg
|
||||||
|
_PushCurrentArg();
|
||||||
|
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<std::string>& ArgVector() const
|
||||||
|
{
|
||||||
|
return fArgVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t TotalStringSize() const
|
||||||
|
{
|
||||||
|
return fTotalStringSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _PushCurrentArg()
|
||||||
|
{
|
||||||
|
if (fCurrentArgStarted) {
|
||||||
|
fArgVector.push_back(fCurrentArg);
|
||||||
|
fTotalStringSize += fCurrentArg.length() + 1;
|
||||||
|
fCurrentArgStarted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _PushCharacter(char c)
|
||||||
|
{
|
||||||
|
if (!fCurrentArgStarted) {
|
||||||
|
fCurrentArg = "";
|
||||||
|
fCurrentArgStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fCurrentArg += c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// temporaries
|
||||||
|
std::string fCurrentArg;
|
||||||
|
bool fCurrentArgStarted;
|
||||||
|
std::vector<std::string> fArgVector;
|
||||||
|
size_t fTotalStringSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ArgumentVector::ArgumentVector()
|
||||||
|
:
|
||||||
|
fArguments(NULL),
|
||||||
|
fCount(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ArgumentVector::~ArgumentVector()
|
||||||
|
{
|
||||||
|
free(fArguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char**
|
||||||
|
ArgumentVector::DetachArguments()
|
||||||
|
{
|
||||||
|
char** arguments = fArguments;
|
||||||
|
fArguments = NULL;
|
||||||
|
fCount = 0;
|
||||||
|
return arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ArgumentVector::ParseError
|
||||||
|
ArgumentVector::Parse(const char* commandLine, const char** _errorLocation)
|
||||||
|
{
|
||||||
|
free(DetachArguments());
|
||||||
|
|
||||||
|
ParseError error;
|
||||||
|
const char* errorLocation = commandLine;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Parser parser;
|
||||||
|
error = parser.Parse(commandLine, errorLocation);
|
||||||
|
|
||||||
|
if (error == NO_ERROR) {
|
||||||
|
// Create a char* array and copy everything into a single
|
||||||
|
// allocation.
|
||||||
|
int count = parser.ArgVector().size();
|
||||||
|
size_t arraySize = (count + 1) * sizeof(char*);
|
||||||
|
fArguments = (char**)malloc(
|
||||||
|
arraySize + parser.TotalStringSize());
|
||||||
|
if (fArguments != 0) {
|
||||||
|
char* argument = (char*)(fArguments + count + 1);
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
fArguments[i] = argument;
|
||||||
|
const std::string& sourceArgument = parser.ArgVector()[i];
|
||||||
|
size_t argumentSize = sourceArgument.length() + 1;
|
||||||
|
memcpy(argument, sourceArgument.c_str(), argumentSize);
|
||||||
|
argument += argumentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
fArguments[count] = NULL;
|
||||||
|
fCount = count;
|
||||||
|
} else
|
||||||
|
error = NO_MEMORY;
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
error = NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error != NO_ERROR && _errorLocation != NULL)
|
||||||
|
*_errorLocation = errorLocation;
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ UsePrivateHeaders kernel libroot ;
|
|||||||
StaticLibrary libshared.a :
|
StaticLibrary libshared.a :
|
||||||
AboutMenuItem.cpp
|
AboutMenuItem.cpp
|
||||||
AboutWindow.cpp
|
AboutWindow.cpp
|
||||||
|
ArgumentVector.cpp
|
||||||
CalendarView.cpp
|
CalendarView.cpp
|
||||||
ColorQuantizer.cpp
|
ColorQuantizer.cpp
|
||||||
CommandPipe.cpp
|
CommandPipe.cpp
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "kernel.h"
|
|
||||||
|
#include <compat/sys/kernel.h>
|
||||||
|
|
||||||
|
|
||||||
int ticks;
|
int ticks;
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void
|
|||||||
openlog_team(const char *ident, int options, int facility)
|
openlog_team(const char *ident, int options, int facility)
|
||||||
{
|
{
|
||||||
if (ident != NULL)
|
if (ident != NULL)
|
||||||
strcpy(sTeamContext.ident, ident);
|
strlcpy(sTeamContext.ident, ident, sizeof(sTeamContext.ident));
|
||||||
|
|
||||||
sTeamContext.options = options;
|
sTeamContext.options = options;
|
||||||
sTeamContext.facility = SYSLOG_FACILITY(facility);
|
sTeamContext.facility = SYSLOG_FACILITY(facility);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ remove_dir_contents(Path& path, bool force, bool removeAttributes)
|
|||||||
{
|
{
|
||||||
// open the dir
|
// open the dir
|
||||||
DIR* dir = opendir(path.GetPath());
|
DIR* dir = opendir(path.GetPath());
|
||||||
if (dir < 0) {
|
if (dir == NULL) {
|
||||||
fprintf(stderr, "Error: Failed to open dir \"%s\": %s\n",
|
fprintf(stderr, "Error: Failed to open dir \"%s\": %s\n",
|
||||||
path.GetPath(), strerror(errno));
|
path.GetPath(), strerror(errno));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user