GSoC 2014 Friday Report #7

Todo For This Week

  • Send multiple usb packets worth of server response to client
  • Refactor everything to be better

Completed This Week

  • Multiple usb packets sent to client
  • Many functions refactored, thank you to Eric Fiselier (https://github.com/EricWF) for valuable help
  • Support content-length http messages
  • Support transport-encoding chunked messages
  • Rename project to IPPUSBXD

Todo Next Week

  • Rewrite USB and TCP to not need knowledge of message size
  • Book flight and hotel for OpenPrinting Summit

This Monday I got content-length messages supported. Which was fantastic news to present on Tuesday’s OpenPrinting conference call. Earlier on the weekend I noticed Mac OSX’s version of ippusbd was also called ippusbd. I mentioned this and Ira suggested renaming my ippusbd to ippusbxd.

So now I’m working on ippusbxd! I like the new name, it looks pretty good on the logo:

ippusbxd_logo

Also on the conference call I mentioned the “only” feature left to implement was supporting chunked transport http messages.

I was wrong.

Just today I landed chunked transport support upon which this greeted me in my browser:

2014-06-13-184835_3600x1080_scrot

Ha! This is a major set back! HTTPS wraps the entire HTTP messages in encryption. Thus preventing us from knowing the HTTP message’s size. In the current architecture this in turn prevents us from know when to stop asking for more data. If we went as far as integrating OpenSSL or a similar we could make a half-solution and man-in-the-middle attack the SSL connection, which would not be pretty.

Instead I’ll have to rewrite a decent chunk of the HTTP handling to not need the message size. We can avoid attacking the SSL connection and simplify the code if instead of using blocking TCP receives calls we use non-blocking calls. This lets us ferry data between the client and the server without worrying if any data is even coming from the client or the server.

This will require some strategic sleep()s to prevent 100% CPU usage but should work well in practice.

The other option could be to ask HP to disable HTTPS since ipp over usb requests never hit the internet. I like having everything encrypted so I’m glad this option is avoidable.

Still looking back this does mean all of the week’s work will be redone. The driver will be better for the rework. The codebase will be smaller and safer. So I’m not sad about the lost effort, plus it gives me something to mention at the OpenPrinting Summit.

In fact unless I knew ahead of time we needed HTTPS I might still think inspecting the HTTP for the message size was the best solution as it provides lower latency.

GSoC 2014 Friday Report #6

Todo For This Week

  • Open the found interfaces
  • Push the http message over bulk transport
  • Echo to command line any response from bulk transport

Completed This Week

  • Interfaces opened and stored in struct usb_sock_t
  • Client’s http request pushed to printer
  • First USB packet of Printer’s echo’d to command line
  • Refactored the tcp handling out of the http stuff
  • Detaches kernel driver if it has already claimed the printer
  • Option to direct error and warning messages to syslog

Todo Next Week

  • Send multiple usb packets worth of server response to client
  • Refactor everything to be better

More good progress this week. The USB interface stuff went faster than expected so I started on refactoring. Then on Wensday afternoon I decided to relax and play a new game I bought: Factorio,  a fantastic game of factory building.

Back when Command & Conqour 3 was released I thought it would be cool if instead of mining crystals and building tanks, you just mined crystals and built more crystal mining stuff. Factorio is that game times ten and this is a problem for me.

Factorio is so fantastic and fits my interests so well I played almost none stop from Wednesday afternoon, to 5am in the morning on Tuesday, woke up at 13:00 then played all day until 4am in the morning on Friday. In total over 20 hours in two days. I would look at the clock and notice time had jumped 5 hours ahead, and then resume playing.

You can see this in the git log. Progress is good until Wednesday afternoon at which point the addiction hits and nothing gets done for a day and a half.

The part that makes me feel bad is I was taking time off making things (ippusbd) to make imaginary things. Other games I’ve played have never been this bad. Ones like Fallout 3 are fun for 2-3 hours sessions then I have a natural inclination to take a break, thus I never risk letting myself get carried away. Meanwhile in Factorio there was always something to make, design, or tune be it the Oil supply line or the iron plate production line.

Thus to me Factorio is too good and I cannot handle it. This morning I deleted the game and all savefiles and I intend to not play ever again. I’d recommend Factorio to others except it brings up the MMO catch-22: liking it is the worse case scenario.

GSoC 2014 Friday Report #5

Todo For This Week

  • This time I’ll add basic usb connecting
  • Refactor to segregate http specific structs from the generic message and packet structs

Completed This Week

  • Usb opens devices and counts the IPP-USB capable interfaces
  • HTTP’s structs are now seperate from USB’s structs
  • Command line option parsing
  • Help message

Todo Next Week

  • Open the found interfaces
  • Push the http message over bulk transport
  • Echo to command line any from bulk transport

Good week, learned lots about USB descriptors. If anything USB is pretty nice.

GSoC 2014 Friday Report #4

Todo For This Week

  • Hack udev-config-printer to startup ippusbd
  • Decide if ippusbd should be a separate package or part of cups-filters as Till suggested
  • Switch to automake if ippusbd is to be part of cups-filters

Completed This Week

  • Added http handling, does not support chunked transport or session reuse
  • Looked at automake, not as bad as its reputation
  • Setup Travis CI
  • Setup Coverity, which has already caught two tricky bugs

Todo Next Week

  • This time I’ll add basic usb connecting
  • Refactor to segregate http specific structs from the generic message and packet structs

I have proven one thing over these four weeks: I cannot make a good weekly todo list. This week had fantastic progress yet it was on the complete opposite side of ippusbd from the usb handling I promised.

Next week should bring initial USB support but I expect proper basic USB handling to take two weeks. USB is a new area for me and I can only expect delays.

One thing I have decided on is I want ippusbd to be a stand-alone package. Till suggested merging ippusbd into the cups-filters package which would work but I want to take on the responsibility of maintaining my code long-term. In either case it should help adoption of printer under linux if a complete IPP print path can be installed without traditional filters, which a sperate ippusbd is a part of. Our full print stack is too heavy for distros like Android or Chromeos but IPP only might be light enough.

Notes on some games in the Wars genre

Mecho Wars

mechowars

  • No fog of war
  • Super high quality animation
  • First strike advantage
  • Terrain provides defence
  • Decent unit silhouettes
  • High quality attack animations
  • Turns take an “hour” and daylight shifts
  • No water units?
  • No rivers
  • Heavy focus on indirect attacks
  • Air units common
  • Attack screen is never split screen. All attacks similar to Advance War’s indirect attacks.
  • City capture rare
  • Storyline
  • Instant city capture

Famicom Wars

  • Minor commander powers only in Super Famicom edition
  • No first strike advantage
  • City capture common
  • Has ammo and fuel
  • Units may have two attack modes

 

Advance Wars

  • Commander powers
  • First strike advantage
  • Self-destructive units
  • City capture common
  • Units may have two attack modes
  • Has ammo and fuel
  • Storyline

 

Front Wars

frontwars

  • End turn has 5 second skip-able countdown
  • 2 team unique art
  • Attack screen is split screen
  • First strike advantage
  • Decent attack animations
  • Terrain gives defence

Gachinko Wars

gachinkowars

  • Produce units from HQ like Famicom Wars
  • First strike advantage
  • Fast animations
  • Poor attack animations
  • Terrain provides defence
  • City capture common
  • City capture occurs by leaving a unit on a city
  • Upgrade cities for 150% revenue
  • Units can be merged
  • Far moves per turn
  • Cannot attack just built units
  • Must surround (as games calls it: siege) factories to occupy
  • Cannot win by killing all units
  • Victory requires capturing all cities and factories
  • No ammo or fuel

Tacikon

tactikon

  • Decent sprite art
  • super large maps
  • Cities can garrison units
  • City capture common
  • Instant city capture

Uniwar

uniwar

  • Has fog of war
  • No separate attack screen, all attacks over in overworld
  • Hexagon tiles
  • Decent animations
  • Sprites can rotate two directions, not always facing enemy
  • Units can repair in field
  • End turn has 5 second skip-able countdown
  • No first strike advantage
  • City capture rare
  • Place-able mines
  • 2 teams with unique art
  • No ammo or fuel

Great Big War Game

greatbigwargame

  • Attack screen is a 3d zoom focus into the two units
  • 3d art
  • Has fog of war
  • Special engineer unit for city capture
  • 10 vehicles + 9 infantry types
  • Instant city capture
  • City capture common
  • All attacks long distance
  • Elevation increases range
  • Elevation affects range of sight
  • Units can be promoted
  • has ammo and fuel
  • Infantry identified by icon on head
  • Fresh built units can move first turn
  • Artillery has splash damage
  • Factories produce multiple units per turn
  • Units cannot move onto buildings
  • Heavy rock-paper-scissors
  • Medics can heal infantry
  • Move multiple times per turn until movepoints consumed
  • Captured factories can produce units
  • Victory requires destroying HQ