LQ Newbie
Registered: Mar 2006
Posts: 2
Rep:
|
Ca-42 clone ( 6547:0232 ) Solved
Hai,
Ive got CA-42 cable clone using this chips.
I used usbsnoop on my winblows then converting to the following :
me using this with nokia 2115 cdma on archLinux.
-------start of code fxusb.c -------------
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/tty.h>
#include <linux/module.h>
#include <linux/usb.h>
#include "usb-serial.h"
int debug=0;
static int fxusb_attach(struct usb_serial *serial);
static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x6547, 0x0232) },
{ },
};
MODULE_DEVICE_TABLE(usb, id_table);
static struct usb_driver fxusb_driver = {
.owner = THIS_MODULE,
.name = "fxusb",
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
};
static struct usb_serial_driver fxusb_device = {
.driver = {
.owner = THIS_MODULE,
.name = "fxusb",
},
.id_table = id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
.num_bulk_out = 1,
.num_ports = 1,
.attach = fxusb_attach,
};
#define FXUSB_SND(a,b,c,d) rst = usb_control_msg(serial->dev,usb_sndctrlpipe(serial->dev,0), a,b,c,d,NULL,0x00, 1000)
#define FXUSB_RCV(a,b,c,d) rst = usb_control_msg(serial->dev,usb_rcvctrlpipe(serial->dev,0),a,b,c,d,buf,0x0000001, 1000)
static int fxusb_attach(struct usb_serial *serial) {
char *buf;
int rst;
rst=0;
buf = kmalloc(1, GFP_KERNEL);
if (!buf) {
dbg("error kmalloc");
return(-1);
}
FXUSB_RCV(0xfe,0xc0,0x0000,0x0003);
dbg("7 control msg return : %d = %0x", rst,buf[0]);
FXUSB_RCV(0xfe,0xc0,0x0000,0x0004);
dbg("12 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0001,0x0004);
dbg("17 control msg return : %d = %0x", rst,buf[0]);
FXUSB_RCV(0xfe,0xc0,0x0000,0x0004);
dbg("18 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0003,0x0004);
dbg("19 control msg return : %d = %0x", rst,buf[0]);
FXUSB_RCV(0xfe,0xc0,0x0000,0x0006);
dbg("20 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0082,0x0003);
dbg("147 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x000d,0x0000);
dbg("148 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0000,0x0001);
dbg("149 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0002,0x0003);
dbg("150 control msg return : %d = %0x", rst,buf[0]);
FXUSB_RCV(0xfe,0xc0,0x0000,0x0004);
dbg("151 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0003,0x0004);
dbg("152 control msg return : %d = %0x", rst,buf[0]);
FXUSB_RCV(0xfe,0xc0,0x0000,0x0003);
dbg("153 control msg return : %d = %0x", rst,buf[0]);
FXUSB_SND(0xfe,0x40,0x0003,0x0003);
dbg("154 control msg return : %d = %0x", rst,buf[0]);
kfree(buf);
return(0);
}
static int __init fxusb_init(void)
{
int retval;
retval = usb_serial_register(&fxusb_device);
if (retval)
return retval;
retval = usb_register(&fxusb_driver);
if (retval)
usb_serial_deregister(&fxusb_device);
return retval;
}
static void __exit fxusb_exit(void)
{
usb_deregister(&fxusb_driver);
usb_serial_deregister(&fxusb_device);
}
module_init(fxusb_init);
module_exit(fxusb_exit);
MODULE_LICENSE("GPL");
-----------end of code-------------
|