So the refactored code from now on to be call krum KeyRing Upload Manager works but I get some sequences returning different values from the original snoopy logs. Also the device is left in what seems to be a hung state, though unplugging an replugging fixes that.
Now to get it to print out the number of stored images...
The original USBSnoopPro team are setting me up with developer access to commit my changes and the refactored code (finally) is back to the stage the proof of concept code was at.
I a strange change of heart I am starting to enjoy Serious Sam II, but only since the China stages, there are still problems but the fun is starting to creep back in. Glad I stuck to it, more later...
Appears you can not commit to an SF project unless you are a registered dev and there has been no life in the project since 2002, still I emailed all the original devs so you never know.
Note to self: do not try and read URBs after midnight ...
My refactored libusb based code is cleaner than the working proof of concept stuff but it is taking a long time to get to the same reliability.
Not so longago I had a simple plan, well that plan is almost at an end.
My re-hacked version of SnoopyPro has
command line switches (now on referred to as flags)
larger default column sizes, so you do not need to manually resize them every time.
An auto Analyze Log flag so that step is removed
An auto dump to text flag, although I no longer needed it might be handy to someone.
An auto dump to XML flag
A base16 flag, which makes the XML output hex and a bit nicer in format.
and exit ASAP flag for batch processing (currently not implemented).
and handles /? so you can see all these options.
If you were to diff the code and see what changes I had made there would be very few, but I had been trying all sorts of different approaches to get the results I wanted. In fact it will be interest to see if anyone corrects my bad c++ when I commit my changes to CVS, or if no one has a working build environment ;)
I read Harry Potter and the Deathly Hallows this morning and I did not have to queue at midnight like some people I know. And so to ruin it for the rest of you here is what happens;
"They put up a tent and Ron makes tea"
Wow! earth shattering, yes I read one whole sentence are being crammed in Victoria line train this morning. Not impressed.
Alex is standing unaided so locks have had to be put on, well everything, the wii is locked up tight.
His crawling speed has increased exponentially so the cats are having to watch out or suffer a 'grabbing'.
Next step is walking unaided, he already has no problem walking with a block trolley.
I have succeeded in getting the number of images off the keyring, but it is all proof-of-concept code and is ugly as hell.
Also the device is locked after I have run it through its paces and requires physically being unplugged/replugged.
Where do I get ABORT and RESET URBs from ??
Next step is to recoded it and then add DELETE-ALL functionality, the Windows software can not delete specific files either.
Wine is my savior, using snoopypro in wine has made it so easy to see what is going on its is scary. More on that when I have something concrete, although I will say I have found what seems to be the image count !
Just a quick update on the snoopy hacking, did not spend a lot of time on it but I did get it to compile perfectly with my own menu item and to get it to automatically run the "analyze log" and expand all URBs.
Though saying that my win usage preferred the URBs collapsed...
OK so that did not go so well, so back to the snoopy.
After adding a few directories to the list that VS6 used and copying the Debug folders to Release it built and ran!!
Now to hack my hacky file dump hack ...
hmmmm seems my visual C++ foo is low, this is complex stuff.
So all the work I have been doing *snigger* has paid off, me and all the other devs (mostly contractors) here just got a package.
Inside is a .... brand new, no questions asked Zune !
but the software does not work in Windows 2003 so I am installing winxp in vmware server, which has downloaded over 60 updates !
The Zune itself looks nice (black), with a big screen, I am told the resolution is the same as the smaller screens of the iPod.
First thing that strikes you trying out the default content is the screen needs to be rotated 90 degrees to watch (any) movie but all the menus always require the system to be upright.
Trolling through the provided videos was a pain what with rotating the screen each time to use the menu.
OK, as I was writing this SP2 was downloading and installing, 3 more virtual reboots and over 30 more updates and the Zune software installs, but then blue screens the VM when detecting hardware :(
Got it home onto Sarah's windows XP machine and after about an hour of Zune updates the firmware upgrade seems to be the at the point vmware sank.
I had a simple plan. USBSnoopyPro is the best place to review USB log files and a number of Linux people run WINE just for this reason.
I tried it myself and USBSnoopyPro run fine in WINE. So what was my plan ?
Get the source for snoopyPro and add a hack to dump the tree control to a text file, everybody is happy.
Step 1: get source [x]
Step 2: open project [x] (wants to convert everything to .net, OK)
Step 3: build [-] fails, needs Windows Driver Development Kit, DDK.
Step 4: get DDK
Step 5: build [-] fails, needs DDK 2000.
Step 6: get DDK2000 [x] turns out you can only get this from MS archives, which I have access too, takes 3 hours to copy.
Step 7: install DDK2000 [-] installs but fails because it needs visual studio 5-6
Step 8: get vmware server, install windows 2000, install visual studio 6, install DDK2000 [x]
its a good thing there is no work actually required at 'work', although I am ready if there ever is.
7 virtual reboots and 2 host restarts later ...
Step 9: shift DDK files around so they can be seen by the build process, adding to include path did not work.
one last error about ml, ...
and then a package arrived. .. ... ..... .......
Serious Sam II sucks!
I loooved the first one, it should be recommended gaming to anyone who enjoys FPS especially the original doom/doom II and quake.
Serious Sam I is serious fun, the fun factor is off the scale, fun clever, loved it.
But SSII is everything SSI was not. It is as if someone in marketing said "Serious Sam sales are really good, lets make a sequel", then the meeting went on with "OK tell me what it was about and I will get a new team on it straight away".
"loads of enemies all the time, odd humor, big guns", "OK, I will have that released to market ASAP".
SSII has loads of enemies all the time, has odd humor and big guns but it has none of the original fun factor.
There are large play areas in SSII like in SSI but there are hidden blocks to stop you going into any of them !
I hate the idea of not completing a game I playing but this is so bad I may just give up.
Avoid Serious Sam II at all costs and if you have not yet played (and completed) Serious Sam the original then what are you waiting for !?
good news everyone !
I had begun to lose hope with understanding the USB URBs from the digital image keychain, when I contacted this guy asking about his USB exploits.
He mentioned two key things, one: usblogdump loses endpoint identification and two that you can run usbsnoopyPro in WINE to review the data.
So first up I found I had been basing all my assumptions on the all the URBs using endpoint 0, but that was NOT TRUE, doh!
Then I went back to usbsnoopyPro and found it had a heck load more information and better labels than the text dumps, doh!
Armed with this new information I immediately started mapping the use of the endpoints (which I will not bore you with here).
A colleague noticed all the Hex on my screen and enquired what I was doing, I explained and added "I would be better off debugging the windows driver".
A light went off in my head and I had a poke at the .INF and .SYS files to find references to MR97310, which turns out to be a known chipset in the GPHOTO2 world.
So there are a number of digital cameras using the Mars MR97310 chip that GPHOTO2 can interface too, and GPHOTO2 is well known as a user of libusb.
Although they are not the same the protocol used is very simular, I hope to be able to get the number of pictures in the keyring out very soon.
Oh, and I also found this handy document to aid my understanding of USB.
There was an amazing array of audio equipment at this months lug, from pre-amps to huge fluffy mics to drums and lutes!
David gave a very good demo of the Jack audio system in Linux which allows lots of music programs to connect to each other, from drum machines to sequencers to track makers to equalizers and effects systems.
Not to mention midi controlled keyboard and a cow bell !
somewhere in all the URB packets is a message "Image Display Controller--Mars Semiconductor Corp. V1", but this message is in the form " m a a a a a a a a a a a a a a a " for the 'a' in "Image" and then for each letter the first character of the data is the previous character followed by 15 duplicated characters.
Odd ? I have been reading more of the USB spec and it is not giving me the information I want, I am not sure I need any of this, so where are the commands I do want??
After setting the configuration to 0x01 and the interface to 0x00 the stream of URBs run a number of ABORTS followed by a RESET. All this on the default endpoint 0x00
After the pipe is reset we get a proper pipe handle...
Then there are loads of BULK_OR_INTERRUPT_TRANSFER with various flags and settings, definitely polling.
I think I need to read more of the USB spec, even though it is soooo long.
Those differing bytes were
00 00
80 00
00 01
80 01
00 02
a8 02
20 03
84 03
ef 03
which appear to be the 9 different configurations shown in the output from lsusb, as I can see a lot of other directly corresponding data.
Wireless thanks to the fish, he(Tux is a 'he' right?) can talk (TTS), sing (audio streaming), rotate, flap, flash his eyes, react to touch (wing/head) comes with lots of Linux software like an IM announcer, email reader, weather reporter, VOIP and all the software is free (as in beer).
A large community supports both users who want to just plug & play and those who want to rewrite the firmware and create their own Tux Droid applications.
At only 79 euros it even comes with remote control that can act as a talking calculator, but does it run on Windows ? No
read more of the USB 2.0 spec and now I know things like "did you know that you can only have seven USB hubs in series" but nothing directly applicable to my project.
On the other hand I did grep the function or the URBs (thats USB packets to you) from my usbsnoopypro logs and nearly all of them are INTERRUPT checks, it seems all the packets are a simple repeated polling.
This was further proved by refining my bash skills and reducing the number of packets that are truly unique to just 138.
But before I tackle the big question I wanted to understand the first ten URBs that are generated when plugging in the device without any software running.
First off there are five distinct communications, one out going and one in coming.
GET_DESCRIPTOR_FROM_DEVICE
GET_DESCRIPTOR_FROM_DEVICE (repeat)
GET_DESCRIPTOR_FROM_DEVICE (different flags set)
SELECT_CONFIGURATION
SELECT_INTERFACE
An interface is a collection of endpoints in a configuration. A good example of a configuration is one with mains power and one without, the device may need to use slower speeds. The interface is like a function of the device, its a bit simplistic but a printer fax could have an interface for the printer and an interface for the fax, these in turn have multiple endpoint which are the options of communicating, i.e. send a message, send large data stream etc.
In the devices response to the third GET_DESCRIPTOR_FROM_DEVICE there was a load of data.
I am sure the USB will (eventually) tell me what it all means but I did note that it was repeating at 58 bytes and that only the 14th/15th bytes changed.
Well I read the Linux Device driver chapter 13 and all it did is reinforce my view of how USB is "supposed" to work. So why did I end up with 65 thousand packets ?
1500 for a simple connect interrogate number of free slots and disconnect ?
I have also started reading the official USB spec, only 650 pages.
642 to go :)
While I am in a bloggy mood here is a book review.
a few years ago I read and enjoyed book one of Chris Wooding's "The Braided Path", so when I saw numbers two and three on amazon I jumped at the chance to continue the fantasy adventure.
"The Skein of Lament" continues Chris's outstanding story telling. I just love the way the story is SO strong and twisted, constantly weaving in and out of what you expect.
If you like fantasy like LotR then this story is for you, I can not wait until I read book three. But will I read it straight away or ponder something else first ?
You maybe wondering why no more blogs on my USB project, well its a lot harder than it first appears, but I do not plan on giving up on it any time soon.
I took my 9 snoopy logs (that had been dumped to text) and split each file into a file for each packet.... 64 thousand files later....
A quick bit of Bash and I could half the average number of packets per capture from 3500 to 1800 using diff and missing out the first few lines that had the packet its in.
I found some great USB info in chapter 13 of the Linux Device Drivers, Third Edition Use the link to openbook to save the entire chapter as a PDF.
Disclaimer:
This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk
I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk
In fact I'm not responsible for anything ever, so there!