This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:fall2015:tmosgrov:journal [2015/10/21 20:07] – [10/19/2015] tmosgrov | blog:fall2015:tmosgrov:journal [2015/12/02 21:02] (current) – [12/02/2015] tmosgrov | ||
---|---|---|---|
Line 371: | Line 371: | ||
====10/ | ====10/ | ||
+ | |||
+ | Quick entry! | ||
+ | |||
+ | Busting my butt on the lair-brary! | ||
+ | Matt gave me a hand with coming up with a solution for handling concurrent file writes. Where a dragon will yell at you other wise. ;P The script looks for a .lock file which means another users is modifying the library' | ||
+ | |||
+ | My initial idea for handling concurrent file modifications was to create some sort of tokenized effort. What I called "last one out" meaning the last user to exit having modified the catalog would consolidate and update the pending updates, but this proved to complicated. I'm starting to learn that programming is about simplification short and sweet. If you over abstract your going to have a hell of a time wrapping your head around it. However, if this is an issue chances are there' | ||
+ | |||
+ | Finally, I thoroughly enjoyed the Richard Stallman talk. It was nice to go to an event with like minded people, and feel apart of a community. | ||
+ | |||
+ | ====10/ | ||
+ | |||
+ | Another quick entry regarding recent finding and ambitions. | ||
+ | Over the weekend I unintentionally worked on many hpc related things. Funny how that happens. | ||
+ | Wound if installing my first third-party library that was offered out side of the standard application packages that are available. A pidgin plugin for facebook chat which had me scratching my head for a while until I found a repository of one of the developers. Facebook had recently moved away from using xamp, and moved to something google based. Go figure. Also, I again played a lot with virtual box (probably more than I should have), but I got the guest additions installed, virtual mounted some directories, | ||
+ | |||
+ | I jumped back on the lair-braryv2 for a bit today I decided to go to fixed window sizes because I did not like the way proportioning the screen with the terminal size work, but I did try it! | ||
+ | Finally, I have been staring at .ogg vorbis wishing I knew more about codecs, audio decoding, and audio decoding. Hopefully, I'll get around to playing with some audio libraries. Just maybe! | ||
+ | |||
+ | See ya! | ||
+ | |||
+ | ====11/ | ||
+ | Wow, today was highly productive in regards to HPC. I came in with a question, and came out with an answer plus code to show! Today was a good day. So, while working on the lair-brary I was struggling finding a way where I could numerically sort the library' | ||
+ | Consider the following input! | ||
+ | |||
+ | <code console> | ||
+ | FFFF BOOK TITLE | ||
+ | AUTHOR NAME | ||
+ | USERNAME DATE etc. | ||
+ | |||
+ | FFFE BOOK TITLE | ||
+ | AUTHOR NAME | ||
+ | USERNAME DATE etc. | ||
+ | </ | ||
+ | |||
+ | Supplemented with... | ||
+ | |||
+ | <code bash> | ||
+ | sed '/ | ||
+ | N | ||
+ | s/\n/[-]/g | ||
+ | N | ||
+ | s/\n/[-]/g | ||
+ | N | ||
+ | s/\n/[-]/g | ||
+ | }' input | ||
+ | </ | ||
+ | |||
+ | Output looks like... | ||
+ | |||
+ | <code console> | ||
+ | FFFF BOOK TITLE[-]AUTHOR NAME[-]USERNAME DATE etc.[-] | ||
+ | FFFE BOOK TITLE[-]AUTHOR NAME[-]USERNAME DATE etc. | ||
+ | </ | ||
+ | |||
+ | Sort! | ||
+ | |||
+ | <code console> | ||
+ | FFFE BOOK TITLE[-]AUTHOR NAME[-]USERNAME DATE etc.[-] | ||
+ | FFFF BOOK TITLE[-]AUTHOR NAME[-]USERNAME DATE etc. | ||
+ | </ | ||
+ | |||
+ | Finally, revert back! | ||
+ | |||
+ | <code bash> | ||
+ | sed ' | ||
+ | </ | ||
+ | |||
+ | Final Output should look like this (note. techinally this example would not work due to the missing newline character on the last entry) | ||
+ | |||
+ | <code console> | ||
+ | FFFE BOOK TITLE | ||
+ | AUTHOR NAME | ||
+ | USERNAME DATE etc. | ||
+ | |||
+ | FFFF BOOK TITLE | ||
+ | AUTHOR NAME | ||
+ | USERNAME DATE etc. | ||
+ | </ | ||
+ | |||
+ | More to come! | ||
+ | |||
+ | ====11/ | ||
+ | |||
+ | So, the weekend was productive. In fact, it was the most productive weekend I have witnessed so far this semester. Tackled tic-tac-toe, | ||
+ | |||
+ | Things keep getting better, and better! | ||
+ | |||
+ | ====11/ | ||
+ | |||
+ | It has been some time since my last submit. However, this time I bring good news. | ||
+ | After mingling around on the internet, and obsessing over a potential new found hobby. Somebody dropped the line usb programming which immediately struck my fancy. What better of a project for datacomm and HPC? What really solidified this was " | ||
+ | |||
+ | This will be where I will record all my resources and information. I hope it will be more interesting than some of my previous posts. | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ====11/ | ||
+ | |||
+ | USB/ | ||
+ | MAX devices 127 | ||
+ | USB devices uses a 7bit address | ||
+ | |||
+ | "All communications on the bus are intiated by the host" | ||
+ | There is no communication usb-device to usb-device. | ||
+ | |||
+ | "A device cannot initiate data transfering, | ||
+ | the host." The only exception being a ' | ||
+ | |||
+ | USB On-The-Go, An interesting extension on the USB spec. | ||
+ | |||
+ | Cables specially designed to only connect host-to-device IE. not host-to-host, | ||
+ | device-to-device. | ||
+ | |||
+ | 4 Wire shielded cable two of which are a twisted pair (D+, D-). The fourth wire (VBUS) | ||
+ | provides 5V supply of power. | ||
+ | |||
+ | Additional Resources | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | Using libusbhid | ||
+ | Ran into libfcntl while reading somones source that reads input from a joystick. | ||
+ | libfcntl or (file control) provides a means to accessing a file that is already open. | ||
+ | Generally after a usb device is plugged in it is already being accessed by the host. | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | "A USB HID report descriptor is one of the descriptors that a USB host can request from a USB device. HID devices send data to the host using reports, and the descriptor tells the host how to interpret the data." | ||
+ | |||
+ | / | ||
+ | |||
+ | ====12/ | ||
+ | |||
+ | Back to USB. I've been looking in all the wrong places. The library I should have been focusing on was libusb which references all of the other libraries I have occasionally stared far too long at. Those of which were probably being referenced as a lower level layer by libusb.h. | ||
+ | |||
+ | Regarding libusb, | ||
+ | When interfacing with usb devices you have two choices Synchronous, | ||
+ | |||
+ | note: Asynchronous offers simultaneous I/O operations or threading. Which libusb supports with its thread-control. | ||
+ | |||
+ | **USB Transfer Types** | ||
+ | * Control Transfers | ||
+ | * Interrupt Transfers | ||
+ | * Isochronous Transfers | ||
+ | * Bulk Transfers | ||
+ | |||
+ | **Control Transfers**- Command or status operations. | ||
+ | |||
+ | |||
+ | **Interrupt Transfers**- Initiated by the device to request some action from the host. | ||
+ | |||
+ | |||
+ | **Isochronous Transfers**- Transfers which are used to carry data the delivery of which is crucial. | ||
+ | |||
+ | |||
+ | **Bulk Transfers**- Transfers which are used to carry data the delivery of which is not crucial. | ||
+ | |||
+ | |||
+ | "All transfers take the form as packets, which contain certain control information and error checking fields." | ||
+ | |||
+ | **The typical libusb procedure** | ||
+ | - Get device list | ||
+ | - Clear device list with libusb_free_device_list) | ||
+ | - Claim usb interface with libusb_claim_interface | ||
+ | - Do the desired I/O operations | ||
+ | - Release the device by using libusb_release_interface | ||
+ | - Close the device libusb_close | ||
+ | - Exit session libusb_exit |