/*Copyright (C) 2005 Michael Kasianowicz (xtravar@yahoo.com)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef __P2KUSB_H__
#define __P2KUSB_H__
#include <p2k.h>
#include <usb.h>

/* theorhetically vendor should be the same for both */
/* this seems to work on most phones, too... */
#define P2K_DEFAULT_AT_VENDOR	0x22b8
#define P2K_DEFAULT_AT_PRODUCT	0x4902
#define P2K_DEFAULT_P2K_VENDOR	0x22b8
#define P2K_DEFAULT_P2K_PRODUCT	0x4901

/* later, p2k_phone might be a struct containing a handle - so typedef*/
typedef usb_dev_handle p2k_phone;

struct usb_device * usb_find_device(uint16_t vendor, uint16_t product);


p2k_phone * p2k_phone_connect(struct usb_device *device);
int p2k_phone_change_mode(const char *dev_file);
p2k_phone * p2k_phone_connect_simple(uint16_t at_vendor, uint16_t at_product, 
		uint16_t p2k_vendor, uint16_t p2k_product, const char *dev_file);
int p2k_phone_disconnect(p2k_phone *phone);
int p2k_phone_send(p2k_phone *phone, p2k_packet *packet);
p2k_packet *p2k_phone_recv(p2k_phone *phone);

#endif /* P2KUSB_H */
