View Full Version: ops for linux

camerahacks >>Applications >>ops for linux


<< Prev | Next >>

ygfperson- 08-18-2005
ops for linux
I wrote a partial port of the Ops program Billw has been working on. It's late for me so I'm not going to go into too much detail but it's a Gtk+ program which borrows BillW's code liberally to reimplement his Ops program in a more operating-system neutral way. So far it's capable of opening, unlocking, and formatting the device, and the interface consists only of the 7 buttons on the top of the Ops program (of which the three mentioned work). "Close Camcorder" serves also to shut down the program. "Format" will ask via a dialog box if you're sure about this. I guess it could be compiled in windows with mingw and gtk+, but I haven't tried it. I compiled it with gtk+-2.0 in fedora core 4 like so: gcc -o ops-linux format_camcorder.c unlock_camcorder.c ops-linux.c close_camcorder.c messagebox.c open_camcorder.c -lusb `pkg-config --cflags gtk+` `pkg-config --libs gtk+` -Wall -W Gtk+-1.2 gives errors about a lack of headers files for fprintf and friends... this can be easily fixed with a few includes, but I'm lazy. The next time I have time I plan to make it more complete; or if someone else wants to add to it they're more than welcome to. It's GPL'd like the original program was. http://www.rpi.edu/~schneg/ops-linux-v1.zip

BillW- 08-18-2005

Yay! Can't wait to give this a whirl - I'll be getting a replacement for my dead linux box this friday!

Cosmic Gecko- 08-18-2005

Works like a champ. Fedora Core users may need to do a "yum install gtk+-devel" to get the additional development environment files.

camerabuser- 08-18-2005
Re: ops for linux
I compiled it with gtk+-2.0 in fedora core 4 like so: gcc -o ops-linux format_camcorder.c unlock_camcorder.c ops-linux.c close_camcorder.c messagebox.c open_camcorder.c -lusb `pkg-config --cflags gtk+` `pkg-config --libs gtk+` -Wall -W Gtk+-1.2 gives errors about a lack of headers files for fprintf and friends... this can be easily fixed with a few includes, but I'm lazy. The next time I have time I plan to make it more complete; or if someone else wants to add to it they're more than welcome to. It's GPL'd like the original program was. http://www.rpi.edu/~schneg/ops-linux-v1.zip Thanks. That warning means you'll crash with SIGSEGV on 64-bit Linux. The pointers (64-bit) get treated like ints (32-bit) and that's bad. Normal Linux packaging is like so: 1. put the source in an "ops-1" directory 2. be sure to remove editor backup files 3. be sure to remove *.o files and the executable 4. in the directory above, do: tar zcf ops-1.tar.gz ops-1

ygfperson- 08-19-2005

In general GTK+ laughs in the face of strong typing (at least compile-time typing). I've fixed the warnings by making the program more gtk+-1.2 friendly (mostly by changing a name here or there). I've added 'download last movie' support and 'download all movies' support is moments away. (There's a small bug where the program's file dialog box freezes while the file is being transferred but I'm sure there's a way around that.) The next big step is to implement that file tree view in the windows ops program, and it looks like I'm going to have to choose either GTK+ 2.x or 1.2 and stick with it (probably 2.x). I'm looking at the source to Ops v0.6 right now (and thus far nothing I've written needs updating) so updating it alongside the windows ops should be relatively trivial.

ygfperson- 08-19-2005

Here's the next release: http://www.rpi.edu/~schneg/ops-v2.tar.gz It adds the ability to download the last movie. I removed the "download all" button because it's too difficult to implement right now and its functionality can be done (more difficultly) through the other button. (The problem's pretty much deciding how to separate a directory from a file) There's also a progress bar and a directory tree hidden under it (really tiny). The progress bar doesn't do much because I don't know how to figure out the final size. Since the upload movie button calls the UploadFile function I'm going to see if I can get the tree view working and do the buttons beside it. The buffer size is a measly 64 bytes, which is more a camcorder-in-linux problem than anything I can fix. Here's a screenshot: >

ygfperson- 08-20-2005

It was a pain but I've figured out how to do the tree views in GTK. Basically this means the "Update Directory Listing" button is finished, and now I can begin work on the individual upload/download file buttons. I'll attach a screenshot once I get more done, but it's starting to look like the windows version. I've put in the Monitor Command feature too, but as of right now there's some seg fault bug I need to chase down.

ygfperson- 08-20-2005

here's the next release: http://www.rpi.edu/~schneg/ops-v3.tar.gz It adds the command monitor and the ability to update the file listing. The information is hidden in the pointer field as a pointer to a file_info struct (not that that's incredibly useful info :D) Here's a screenshot: and one of the monitor:

ygfperson- 08-21-2005

http://www.rpi.edu/~schneg/ops-v4.tar.gz Made a bunch of additions: -Download file works -Upload file works (although to overwrite you have to click on the directory the file is in and have your file named like the one your overwriting. Overwriting by clicking on the file directly doesn't work because of a bug. WARNING: in general, make sure the program's behavior is consistent (possibly by overwriting a harmless movie file as practice) before writing over the files your camcorder needs to live. See disclaimer below - double-clicking on a file in the tree-view gets its file size and file name - delete file delete's a file - uploading and downloading files now uses a progress bar. Doing this requires threads (gthread-2.0 library to be exact) so keep that in mind if compiling for another platform. I believe MingW should still stupport this but I'll try to compile it later and find out myself. In general everything now works mostly, just: - 'download all movies' is neglected; just download each file separately - 'upload movie' can be done through 'upload file' - see above comment about uploading Where BillW's ops outputs its log data to a box on screen, this version outputs to standard error in a text console (although since everything goes to Log() this could be changed easily by altering Log()'s behavior). The source code is a mess mostly, and I might make an attempt to clean out all the useless comments and the temporary globals and etc. I assume the program is thread-safe since only one global variable is written to during the thread's operation. The tree is basically a set of data which is a filename and a pointer to a block of file data. This block is malloc'ed and kept track of, but it isn't cleaned out in the end. However, any refreshing of the file tree frees up the memory so the only potential problem is at the end of the program. DISCLAIMER: I don't take responsibility for anything you do with this program. Please be careful and triple check everything. I'll try to answer questions about error messages (log output isn't organized in the least) or bad experiences, but keep in mind that I'm going back to college in a few days so I might be too busy to respond. It's GPL'd, just like the ops program I stole a bunch of its source code from. In the tarball is the source code + Makefile, and an i386 linux executable. I don't know if it'll compile with Macs. In general, it uses GTK+ 2.0 with glib threading (which I assume is implied with GTK 2.0) and libusb so any platform which supports both GTK and libusb should be able to compile the source code... maybe. Have fun :) Thanks to everybody who contributed in some small way to my understanding of things... billw for writing ops, morcheeba for the usb protocol web pages and other firmware stuff, corscaria for writing SaturnDownload, zapped for the monitor experments, brite_eye for this web site, and everybody else I didn't mention! A screenshot:

ygfperson- 08-23-2005
update
I've released ops-for-linux-v0.7 (the version number jumped a few steps so it coincides with BillW's). New features (see BillW's thread for details): - download memory - poweroff camera - longer timeout for send monitor command also, - text fields don't keep their values. I didn't really feel like adding this, that's all. It's not too difficult to implement (a few global variables here to keep track of things, rewriting the MessageBoxText code a bit) so if anyone really wants it I'll give it a shot I also added a "Toggle camera LCD screen" button. It turns on and off the ccd-to-lcd live signal (meaning that the LCD is not turned off, it's just black with text instead of being a viewfinder with text.) It's mostly just there as something to play around with. If you felt like making a trivial addition to this program (like doing the SetClock thing in another thread) you can use the toggle_camera_lcd_screen.c file as a template for writing other cvs-*test*-('")-like poking functions. (Pretty much the whole program is divided up into ops-linux.c, messagebox.c, ops-linux.h, readwrite.c, and one source file for each button.) Also, I included a binary with the previous releases but I figured out it was a few versions old and I forgot to replace it. Sorry bout that. One more also: sometimes downloads or uploads can go so fast that the buttons don't look reenabled properly. They are enabled, try to do something which refreshes its display (like moving the window around, maybe off screen). http://www.rpi.edu/~schneg/ops-for-linux-v0.7.tar.gz Screenshot:

BillW- 08-23-2005

Nicely done ygfperson! With enabled progress bar and screen on/off toggle you've leapfrogged the Windows version! I'll have to get my act together. :P

dattaway- 08-23-2005

beautiful! works like a dream!

ygfperson- 08-23-2005

Thanks for the compliments :) Obviously without stealing a load of sourcecode this would have been 500 times harder I've been looking at the PV2Tool source code... it's strikingly similar. I think I just have to replace the camcorder button code with the appropriate camera button code, which might take a while but not as long as starting from scratch or relearning gtk or implementing directory trees/progress bars again. In any case I'll try to get the program compiled in windows so I can prove it works there too (and hence earn the name 'cross-platform')

ygfperson- 08-24-2005

http://www.rpi.edu/~schneg/ops-supplemental.tar.gz I added a video capture button. Right now it sends the video capture commands and grabs the input (whatever format that may be). There's an option to save to a file; pressing cancel here cancel's the capture. Once the capture starts, a dialog box is put up saying "Click OK when you want to stop capture". If you click cancel here, you will need to terminate the program to stop capture. WARNING: Capturing will leave your camera in an undefined state afterwards. Notice the word 'will'. If things go nicely (not a guarantee!) You should be back to normal after replugging. If you pull it out mid-transfer, try waiting a minute or two for the camcorder to power off by itself. This worked for me (version B1) but it may destroy your camera or set fire to the Pentagon. I don't take responsibility for anything the program does, or for helping people fix problems resulting from it (although I may try). the BUFSIZE define (in ops-linux.h) is set to 64 for a linux enviroment. Linux didn't like it when I upped it from 64 bytes (seg fault), although if you get the program to compile in windows you can try higher values of this. I don't know what the output means yet. I suggest taking a stopwatch and calculating the rate of tranfer of the capture, and seeing if this changes much from attempt to attempt (indicating compression). The linux kernel module zr364xx's source code should give a clue how to figure out the output.

ygfperson- 08-27-2005

Ops for linux is now hosted at the sourceforge site with Billw's ops for windows.... here: http://sourceforge.net/projects/saturntools/ The most current version is in sourceforge's cvs, although at the time of posting the ops for linux v0.7.1 release is exactly the same. If you want to submit a patch, email me, or you can join the development team and get write access to the cvs directory. A lurker called nemesaim im'ed me yesterday with a patch and an offer to help develop the application. If anyone else wants to help, feel free. Nemesaim's patch implements the Download All Movies button and an automatic download feature if ops is called as "ops -d". This plus the capture video button make it ops for linux v0.7.1. My plans currently are to get my cable resoldered so I can continue -*test*-('")ing things. The things I'd like to do: - keep or improve windows compatability (mostly in working with filenames and maybe a different BUFSIZE value) - fix "Upload File" so it works all the time, uploading to file and directory - implement a simple "Upload Movie" based on BillW's code - change "Download Last Movie" to use "Download File" and thus have progressbar support for that too. (It's funny that billw didn't implement progressbar support there for exactly the same reason.) - separate the GUI and the libusb components (this is easier than it sounds due to how much is actually separated right now) - incorporate billw's recent updates in ops into this version - clean up the code and the logging messages (and run indent on everything) Also a big todo that may never find its way to fruition: - port pv2tool to linux in the same way ops was ported nemesaim, billw, and I(ygfperson) are admins on this part of the project.

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.