Probably that was pretty unclear. I modified avrdude 5_11_0 sources in order to: 1. receive additional parameter (socket address) in command-line 2. read file descriptor from the socket using socket address 3. set file descriptor to union filedescriptor 4. use it in serial_open instead of invoking open()
i believe socket code is okay as i've just copied it from another project and i check file descriptor to be valid (see code snippet) and it's positive integer (not -1) 2013/6/10 Anton Smirnov <[email protected]> > > If you get an ENOTTY on setting the baudrate, it would mean your > driver (the part of the operating system that provides the virtual > serial port device) is broken/incomplete. > > that's bad as i tested on few devices of few manufacturers on different > android os versions.. > is there any work around for it (without rooting)? > > > What I don't understand: a "file descriptor" is a small integer > number, as returned by the open() syscall. > > In my case file descriptor is also int value which originally received in > android app (java vm) using UsbDeviceConnection.getFIleDescriptor() which > is written to return file descriptor for native code specially. > then i pass it to avrdude and since it's child process and file > descriptors are process-related i have to use unix socket. > > so i just pass it from android app to native code (via JNI), which creates > thread and pass it using socket. > then i execute modified avrdude executable using socket address and read > file descriptor from the socket and pass it to serial_device which in my > case just use this file descriptor instead of executing open() syscall > > i can share the code if needed (some code snippets are in question on > stackoverflow) > > > 2013/6/10 Joerg Wunsch <[email protected]> > >> As Anton Smirnov wrote: >> >> > This relates to Arduino boards and they have bootloader which talks over >> > USB using stk500v1/v2 and uploads firmware itself. >> >> OK, they indeed use a serial device emulation. >> >> If you get an ENOTTY on setting the baudrate, it would mean your >> driver (the part of the operating system that provides the virtual >> serial port device) is broken/incomplete. >> >> > > > I'm getting file descriptor for usb device on android, grant >> > > > permissions and pass usb device file descriptor to avrdude process >> > > > and getting "Now a typewriter" error in ser_posix while trying to >> > > > set baud rate. >> >> What I don't understand: a "file descriptor" is a small integer >> number, as returned by the open() syscall. You cannot really pass >> such a file descriptor to AVRDUDE since AVRDUDE must obtain one >> itself. >> >> So, what's your actual commandline you call AVRDUDE with? >> >> -- >> cheers, Joerg .-.-. --... ...-- -.. . DL8DTL >> >> http://www.sax.de/~joerg/ >> Never trust an operating system you don't have sources for. ;-) >> >> _______________________________________________ >> avrdude-dev mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/avrdude-dev >> > > _______________________________________________ avrdude-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/avrdude-dev
