Android USB Host API - how to find driver for USB (Prolific) communication -
update 2:
i have tested ftdi chip shorting in , out pins. controltransfer()
returns 0, bulktransfer() - write
returns length of data sent , bulktransfer() - read
returns whatever data sent.
does know how or find driver prolific?
update 1:
i did more testing slick usb 2 , think have found issue. looks missing driver due communication not working.
i connect board slick usb 2 , tried connect using app , printed "open device , claim: false, file = 45, test = null". tried again , communication started working. able write , read data expected. also, when reconnected cable, communication stopped working.
i guess, slick usb 2 installing driver needed communication.
does have idea or how can find driver?
i want android device (galaxy tab 2.0 7", version 4.0.3) communicate custom board. that, using otg cable + usb serial converter (prolific).
i have tested communication slick usb 2 app , works expected.
now, trying create own app using usb host api. have added intent-filter , when connect board, getting recognized well. using below code:
usbdevice usbdevice; // contains device intent-filter context context; // activity object usbmanager manager = (usbmanager) context.getsystemservice(context.usb_service); toast.maketext(context, "usb device perm: " + manager.haspermission(usbdevice), toast.length_long).show(); usbinterface interfaceusb = usbdevice.getinterface(0); usbdeviceconnection connection = manager.opendevice(usbdevice); boolean resclaim = connection.claiminterface(interfaceusb, true); toast.maketext(context, "open device , claim: " + resclaim + ", file = " + connection.getfiledescriptor() + ", test = " + connection.getserial(), toast.length_long).show(); // prints "open device , claim: true, file = 45, test = null" int result = connection.controltransfer(0x40, 0x03, 0x0034, 0, null, 0, 0); // set baudrate 57600 toast.maketext(context, "result: " + result, toast.length_long).show(); // returns -1 int resultwrite = connection.bulktransfer(endpointusbwrite, new byte[]{'a'}, 1, 1000); byte[] bytesread = new byte[64]; int resultread = connection.bulktransfer(endpointusbread, bytesread, bytesread.length, 1000); // resultwrite returns 1, resultread returns -1
the controltransfer()
returns -1. have tried bulktransfer() - write
, returns length of data sent board doesn't receive data. bulktransfer() - read
returns -1
i have done test connected board app , tried connect in slick usb 2 app , slick usb 2 able connect board - shouldn't work. think, not able open device properly.
what missing here? have checked number of threads haven't been able solve issue. can please suggest something?
prolific has developped android sdk pl2303. may download , try from: https://play.google.com/store/apps/details?id=tw.com.prolific.app.pl2303terminal
you can support prolific's official website..
Comments
Post a Comment