vpelletier / python-dfu

Python implementation of USB DFU device class
GNU General Public License v2.0
25 stars 7 forks source link

DFU Master Files are not complete #1

Closed prateek1108 closed 9 years ago

prateek1108 commented 9 years ago

Hello Sir, I am also working on to project to bring iPhone out off DFU mode while updating the firmware of iPhone.....i had clone your excellent work but small problem i am facing in this python-dfu-master code few files are missing from code i.e import libusb1 and import usb1 are showing error so please guide how i can provide these file to python... please help me out regarding this error.....please help me out

vpelletier commented 9 years ago

Hello,

The missing files are part of python-libusb1, which is another of my projects ( https://github.com/vpelletier/python-libusb1 ) and also published on pypi ( https://pypi.python.org/pypi/libusb1 ).

One word of warning though: python-dfu is not as complete as I would wish it to be. I mostly used it to dump existing firmware & switch out of DFU mode rather than reprogramming devices. I implemented it to the best of my knowledge (ie, following the specs), but didn't test it thoroughly. Contributions are welcome !

prateek1108 commented 9 years ago

hello sir, Thank for the precious reply, i am not that much handy in python language should i directly drag and drop the python-libusb1 project files in python-dfu-master code........

vpelletier commented 9 years ago

Hello,

Putting usb1.py and libusb1.py in python-dfu folder works, yes. It is an easy way to get stuff to work quickly, but it is not the recommended way: doing so prevents using existing tools to get newer python-libusb1 versions when they are released. On the other hand, python-libusb1 is small and stable enough to not take too much time to update it manually if needed.

There are a few ways to install python modules separately in a way which allow you to update them - and I must say I never really looked into their specifics, so I cannot really recommend one over the others. Off the top of my head are easy-install ( http://peak.telecommunity.com/DevCenter/EasyInstall ) and pip ( https://pip.pypa.io/en/latest/installing.html ), and I'm sure there are others. Depending on your target environment (windows, linux, OSX with fink, ...) some specific tools may be available as well.

prateek1108 commented 9 years ago

hello sir, Thanks alot sir for providing me valuable guidance, i had cloned the libusb1.py and copied its files in my python-dfu-master code but few error are shown in the libusb1.py....please help me to solve my problem. problem in dfu master

prateek1108 commented 9 years ago

i am using eclipse to debug this code and i had also check this code in command prompt of windows its showing error...... command prompt

vpelletier commented 9 years ago

Note that the highlighted line on the first screen shot has nothing to do with the tracebacks you are getting. These tracebacks mean that python cannot find libusb1 (the C library python-libusb1 wraps). To install it, please see http://libusb.info/ .

As for the highlighted line, I suspect it is my code confusing the analyser: Those "Enum" declaration store values in the global scope, hence defining variables for each of their members. I wrote this code before python had its Enum class, and I thought it would be handy to have these values available at module level, even if it confuses static code analysers. So there is no actual bug at runtime on that line (the value does exist when this line is reached).

prateek1108 commented 9 years ago

Sir, i had gone though the http://libusb.info/ . link.....i want to do this work work in c++ or vc++ by this i directly get the .lib file for libusb work.....is firmware can also be updated by this code.....as i had checked out the example libusb-1.0.19-rc1-win\examples\bin64\fxload.exe

is this for Android or for iPhone firmware updation or for both android and iphone firmware updation. Sir please help me out your help is really precious for me

vpelletier commented 9 years ago

libusb1 is, as the name implies, for USB-level operations: list connected usb devices, open a device, and send/receive some packet to/from some endpoint.

python-libusb1 is just that as well by making possible to call into libusb1's functions from python language - this is why libusb1 needs to be present too when using python-libusb1.

python-dfu is an implementation of the DFU USB device class, which allows higher-level operations than USB (ie, caller does not have to care about which packets to send to achieve such-or-such operation), and does so in python - because I like this language and find myself more efficient with it than in C.

Of course, the same can be achieved from another language, and there may already be some existing library in that language implementing DFU device class protocol. A quick google search brings up: https://dfu-programmer.github.io/ (which mentions using libusb) http://www.emcu.it/DFU-DfuSe/DFU-DfuSe.html Which seem to be ready-to-use software packages. They mention specific device families, but should only impact the way the usb device to use is chosen (ie, vendor & device ids), and possibly some hardware details not available through DFU protocol - and this is where you may risk bricking your device if the code assumes bad things for your hardware.

prateek1108 commented 9 years ago

Sir, Thanks for the reply, i had gone through all the links i found these firmware updates are related to the chip on which we are updating firmware not on the OS or mode of that device ....Please guide me regarding the arguments fxload.exe. exe arguments

vpelletier commented 9 years ago

I was mentioning the OS on the "how to distribute your software" side of the issue, which is what this discussion was originally about (ie, the missing/not obvious dependency between python-dfu, python-libusb1 and libusb1).

Is fxload really using the DFU protocol ? I happen to use it for yet another project, but AFAIK it is specific to a family of cheap micro-controllers usable as USB devices. I do not expect any iPhone to contain an fx-familly µC, they likely have an USB phy directly on the main chip.

Note that I was just giving you some pointers on where you could look next, I don't know all there is about DFU - I only implemented a bit of it to tinker with a device I have :) .

prateek1108 commented 9 years ago

Hello, Thanks a lot sir for your reply, Sir i want to update firmware of iPhone by code please help if you have any idea about the project or article to do my job. Please guide me

vpelletier commented 9 years ago

Sorry, I do not own an iPhone, so I've never looked into this. I wish you the best luck !