Author Archives: danieru

GSoC 2014 Friday Report #14

Todo This Week

  • Fix the rest of the things

Completed This Week

  • Printer’s embedded website now works 100%
  • Submitting print jobs now works 100%

Todo Next Week

  • Start integrating ippusbxd with usb-config-printer
  • Nail down sub topics for presentation on Monday
  • Create slides
  • Practice presentation 3 times
  • Send Ira slides
  • Ask Ira if the projector uses HDMI
  • Ask Eric for permission to relicense

Awesome success this wekk. Everything works and the driver itself is pretty rock-solid. Perfect to demo at the OpenPrinting Summit / Printer Working Group Face2Face / 3D Printing Birds-of-a-feather.

I’ve also decided to relicense under Apache 2.0. I still like strong copyleft but I might as well compromise on my principles since it might get ippusbxd into more platforms. Who knows? Maybe Microsoft will ship it in Windows.

GSoC 2014 Friday Report #13

Todo This Week

  • Fix things

Completed This Week

  • Several things have been fixed

Todo Next Week

  • Fix the rest of the things

Lots of debugging and testing this week. I found why debugging had been so frustrating:

 // Lose connection to caller
 if (fork() > 0 && !debug_mode) <-- BUG
      exit(0);

There was supposed to be a debug mode which did not trigger the fork. A simple bug caused it to do the exact opposite and fork but skip the exit. Thus creating two processes performing the exact same actions. This explains the bug I mentioned last week where it appeared known data was being forgotten. Instead we were seeing output from the second process which had stolen some data from the usb device. Since neither process had the complete dataset both started staling.

With the phantom bug gone the remaining code is acting more logical. I have found it much easier to think about the program now that it does the things the code says it will. Now I can trace a set of request & responses and see when data is being mangled or dropped then review the codepath and find the cause.

The two week deadline I set last week is feeling achievable now.

GSoC 2014 Friday Report #12

Todo This Week

  • Make 6 parallel connections bring up same webpage as single connection browsers.
  • Handle http messages larger than 8KB
  • Complete all the TODOs in http.c

Completed This Week

  • Support large http packets
  • Fixed some crashes
  • Fixed some data loss
  • Fixed a bunch of TODOs

Todo Next Week

  • Fix things

This week consisted of bug fixing and tracking down broken code. I’m not proud to say that things are no really working. I now realize that things only worked a few weeks ago because of another bug. I thought TCP and USB were requiring known message sizes but really they were still passing data back & forth as packets came in.

I’ve fixed many of the bugs but I’m still hitting bugs like this:

01. Note: USB: Getting 262144 bytes of 0
02. Note: USB: Got 320 bytes
03. Note: USB: Getting 8704 bytes of 8953
04. Note: USB: Got 2048 bytes
05. Note: USB: Getting 6656 bytes of 8953
06. Note: USB: Got 2048 bytes
07. Note: USB: Getting 260096 bytes of 0
08. Note: USB: Got 2048 bytes
09. Note: USB: Getting 4608 bytes of 8953
11. Note: USB: Got 2048 bytes
12. Note: USB: Getting 2560 bytes of 8953
13. Note: USB: Got 441 bytes
14. Note: USB: Getting 2048 bytes of 8953
15. Note: USB: Got 336 bytes
16. Note: USB: Getting 260096 bytes of 0
17. Segmentation fault (コアダンプ)

On line 1 of this fresh server responce we see USB did not know what size to expect so it asked libusb for enough data to fill its buffer.

On line 2 USB received  from the printer the message’s header. We can guess this because 320 bytes is an average header size.

Line 3 confirms our header guess because now USB knows how large the HTTP packet will be.

On line 7 USB somehow forgets how large the packet will be, so it asks for a full buffer.

Lines 8 to 15 look normal. Keep in mind in the “Getting X” the X has been rounded up to the nearest multiple of 512. This is something required by libusb so a precaution incase the usb device sends a full 512 byte packet instead of what we expect.

Then on line 16 USB forgets the message size again, just as it did on line 7. Also note how it thinks the buffer has the same amount of spare capacity as it did on line 7.

Then we segfault.

The above bug is something I hit while tracing a different bug where USB was getting data and could not find the packet size at all.

This past week I’ve been adding more and more tracing statements and it has helped. I cannot print the messages themselves since they are too large and the binary requests often break my terminal. Then since data has been left in the USB pipe any new requests are going to get malformed responses, which requires rebooting the printer to clear.

So, I’ve got four full weeks until GSoC ends. I plan to work more afterwards but I don’t want to ask my mentor to “Just trust me, I promise to fix it afterwards”. Instead ippusbxd needs to work. As well there is the Openprinting Summit starting on the 12th and I want to demo ippusbxd there.

The core things which need to get done are:

  1. ippusbxd needs to work
  2. udev-config-printer needs to startup ippusbxd
  3. udev-config-printer needs to add a print queue to cups
  4. cups should identify the printer between reboots

Its hard to estimate how long fixing ippusbxd will take but I cannot see it taking less than 1 week and I cannot afford for it to take more than 3 weeks.

So I’ll plan for it to take 2 weeks.

 

GSoC 2014 Friday Report #11

Todo For This Week

  • Make tcp.c support and require known http size
  • Fix atleast %50 of the TODOs
  • Figure out how ippusbxd should fit in with udev-configure-printer

Completed This Week

  • Made tcp.c now require knowable http message size
  • There are more TODOs than ever

Todo For Next Week

  • Make 6 parallel connections bring up same webpage as single connection browsers.
  • Handel http messages larger than 8KB
  • Complete all the TODOs in http.c

Slow week, every time I completed a TODO I find one or two more things to mark TODO. Thinking through the buffer handling edge cases can be a bit confusing and not very much fun.

GSoC 2014 Friday Report #10

Todo For This Week

  • Get new printer working group website in shipable state
  • Do not touch ippusbxd codebase

Completed This Week

  • Finished the todo list for the new PWG website
  • Only touched ippusbxd once

Todo Next Week

  • Make tcp.c support and require known http size
  • Fix atleast %50 of the TODOs
  • Figure out how ippusbxd should fit in with udev-configure-printer

Perhaps the biggest news this week was I got approved from the Linux Foundation for travel funding. So thank you to the Linux Foundation’s members, this will save a decent chunk of the GSoC stipend from going to travel and hotel costs.

After the week off I’m looking forward to working again on ippusbxd. The codebase is in workable prototype stage and I’ve got 2 months to make it robust.