Register

9860GII Power Graphic 2 transfer problem with using xfer9860

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

9860GII Power Graphic 2 transfer problem with using xfer9860

Postby hhacker » Sat Mar 30, 2013 6:08 am

hi everyone,
I just bought my third calculator which 9860 GII Graphic 2,and I got some weird problem here.
My upload program can transfer certain files to 9860(based on Casio fx-9860G communication utility,aka xfer9860),which is works fine on 9750 GII,9860 slim and 9860 GII SD.
But this new GII Graphic 2 cannot response my command anyway,I used BusHound to capture communicate info,it seems like connection works fine but any OUT command I sent to Endpoint 1 just got no response error,it makes me confused.
Please give me some advice about how to solve this problem.
Thanks for your time.

btw,fa-124 works fine with Graphic 2,I captured its communications(just few lines capture info when connection was established):

Device Phase Data Description Cmd.Phase.Ofs(rep)
------ ----- -------------------------------------------------- ---------------- ------------------
28.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 1.1.0
28.0 IN 12 01 01 01 00 00 00 40 cf 07 01 61 00 01 01 02 .......@...a.... 1.2.0
00 01 .. 1.2.16
28.0 CTL 80 06 00 02 00 00 09 02 GET DESCRIPTOR 2.1.0
28.0 IN 09 02 27 00 01 01 00 c0 32 09 04 00 00 03 ff 00 ..'.....2....... 2.2.0
ff 00 07 05 82 02 40 00 00 07 05 01 02 40 00 00 ......@......@.. 2.2.16
28.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 3.1.0
28.0 CTL 41 01 00 00 00 00 00 00 VENDOR 4.1.0
28 IN 5.1.0
28.1 OUT 05 30 30 30 .000 6.1.0
28.1 OUT 37 30 70 7.1.0
28 IN 8.1.0
28.2 IN 06 30 30 30 37 30 .00070 9.1.0

Senior Member
Posts: 369
Joined: Tue Jan 03, 2012 11:24 pm
Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby helder7 » Sat Mar 30, 2013 12:44 pm

xfer9860 does not work well with GII models.
But PierrotLL found a solution for it work with GII models:

PierrotLL wrote:To adapt xfer9860 for fx9860gII, I know you have to change the constant T_POSITIVE (Casio9860.h line 70). 0x06 is the value for first fx9860, on the new ones it's 0x05.
To accept the two values, you may change function fx_doConnVer (Casio9860.c line 131).


I dont know if this changes also work with Power Graphic 2, but you can test and give your feedback.
SiO2 + CaCO3 ----------> CaSiO3 + CO2

Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby hhacker » Sat Mar 30, 2013 1:35 pm

I already wrote a bug fix for GII,but it's not work for graphic 2.
After connection established,Any OUT command will receive no response error,when I try this again,It just show a STALL PID error.
I guess after CLEAR FEATURE finished,maybe I need set Endpoint 0 to STALL manually,also set endpoint 1&2 to VALID.But it seems like libusb did not offer a function to do these things.

Senior Member
Posts: 369
Joined: Tue Jan 03, 2012 11:24 pm
Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby helder7 » Sat Mar 30, 2013 6:27 pm

I can not help much more since I do not use linux and i dont own a Power Graphic 2.

Some offtopic: Have you tested the screenstreamer? (If yes, you could use it with a GII calc?)
SiO2 + CaCO3 ----------> CaSiO3 + CO2

Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby hhacker » Sun Mar 31, 2013 12:03 am

helder7 wrote:I can not help much more since I do not use linux and i dont own a Power Graphic 2.

Some offtopic: Have you tested the screenstreamer? (If yes, you could use it with a GII calc?)

Thanks for your help.
Compare with 9860GII,Graphic 2 's OS version was upgrade to 02.02.0201,It's just a little rise.
Since Graphic 2 changed it's cpu to SH4A,maybe it has some hardware difference.
...sigh,Maybe debug FA-124 is my only choice,but it's too waste time.

Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby hhacker » Mon Apr 01, 2013 2:24 am

I'll trying to move on libusb 1.0,hope it works.

Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby hhacker » Wed Apr 03, 2013 3:39 pm

libusb1.0 with WinUSB driver is worked,everything looks fine now.

User avatar
Posts: 89
Joined: Thu Apr 05, 2012 3:16 pm
Location: Akron, OH, USA
Calculators: Casio fx-9750GII, Casio fx-CG10

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby flyingfisch » Sat Apr 06, 2013 12:20 am

hhacker wrote:libusb1.0 with WinUSB driver is worked,everything looks fine now.


Could you send me your version? I cant get my hacked 9750GII to communicate with xfer...

Junior Member
Posts: 9
Joined: Sat Mar 30, 2013 4:43 am
Calculators: Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby hhacker » Sat Apr 06, 2013 1:39 am

OK,I'll post it here,the key frame is you need waiting for calculator to response 0x6 when you send something in.
I have changed it in usbio.c:
Code: Select all
int ReadUSB(struct libusb_device_handle *usb_handle, char *buffer, int length) {
   int ret = 0;
   int BytesRead = 0 ;

   ret = libusb_bulk_transfer(usb_handle,0x82,buffer,length, &BytesRead,USB_READ_TIMEOUT);
   if (fx_getPacketType(buffer) != T_POSITIVE) {
       ret = libusb_bulk_transfer(usb_handle,0x82,buffer,length, &BytesRead,USB_READ_TIMEOUT);
    }

   if (ret < 0) { printf("ERR: ReadUSB(): Could not read: %i\n", ret); }
   debug(1, buffer, ret);
   return ret;
}

When I got positive reponse,i just read it again,everthing is ok.The only porblem is it will slow down my graphic2's transfer speed a little(but can ignored).

My past code use libusb_win32's driver as a fillter,it seems did not compatible with my 9860 Graphic2 cal,so I change it to libusb 1.0 with WinUSB driver,I did not go back to libusb0.1 and test it for linux,but it should be ok if your cal is not graphic2.

There is a download link in my blog,be noticed,my program's main function is upload a few certain files to casio 9860 cal.
I did not change most of xfer9860 code but upgrade it to libusb 1.0 library(api name is different),and I didn't clean up my code yet,so it has some useless comment code.

http://hhacker.com/wp-content/uploads/2013/04/OneClickInstall.zip

User avatar
Posts: 89
Joined: Thu Apr 05, 2012 3:16 pm
Location: Akron, OH, USA
Calculators: Casio fx-9750GII, Casio fx-CG10

Re: 9860GII Power Graphic 2 transfer problem with using xfer

Postby flyingfisch » Sat Apr 06, 2013 9:18 pm

I can't build that code...


I changed line 70 in Casio9860.h to:

Code: Select all
#define T_POSITIVE   0x05


The I edited usbio.c to look like this:

Code: Select all
/*******************************************************************************
   xfer9860 - a Casio fx-9860G (SD) communication utility
   Copyright (C) 2007
      Andreas Bertheussen <andreasmarcel@gmail.com>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   MA  02110-1301, USA.
*******************************************************************************/

#include "usbio.h"
#include "config.h"

#include <stdio.h>
#include <usb.h>

void debug(int input, char* array, int len){
#ifdef SNOOP
   unsigned char temp;
   int i, j, line = 0;

   if (input) { fprintf(stderr, "<< "); }
   else { fprintf(stderr, ">> "); }

   for (i = 0 ; i < len ; i++){
      temp = (unsigned char) array[i];

      if (i % LEN_LINE == 0 && i != 0){
         fprintf(stderr, "\t");
         for (j = line; j < line + LEN_LINE; j++){
            char u = (unsigned char) array[j];
            if (isprint(u)) { fprintf(stderr, "%c", u); }
            else { fprintf(stderr, "."); }
         }

         line = i;
         fprintf(stderr,"\n");
         if (input) { fprintf(stderr, "<< "); }
         else { fprintf(stderr, ">> "); }
      }

      fprintf(stderr,"%02X ", temp);
   }

   if (i % LEN_LINE != 0)
      for (j = 0 ; j < (int)(LEN_LINE-(i % LEN_LINE)); j++)
         fprintf(stderr,"   ");

   fprintf(stderr, "\t");
   for (j = line; j < len; j++){
      temp = (short unsigned int) array[j];
      if (temp > 31)
         fprintf(stderr, "%c", temp);
      else
         fprintf(stderr, ".");
   }

   fprintf(stderr,"\n\n");
#endif /* SNOOP */
}

int ReadUSB(struct libusb_device_handle *usb_handle, char *buffer, int length) {
   int ret = 0;
   int BytesRead = 0 ;

   ret = libusb_bulk_transfer(usb_handle,0x82,buffer,length, &BytesRead,USB_READ_TIMEOUT);
   if (fx_getPacketType(buffer) != T_POSITIVE) {
       ret = libusb_bulk_transfer(usb_handle,0x82,buffer,length, &BytesRead,USB_READ_TIMEOUT);
    }

   if (ret < 0) { printf("ERR: ReadUSB(): Could not read: %i\n", ret); }
   debug(1, buffer, ret);
   return ret;
}

int WriteUSB(struct usb_dev_handle *usb_handle, char *buffer, int length) {
   int ret = 0;
   ret = usb_bulk_write(usb_handle, 0x1, buffer, length, USB_WRITE_TIMEOUT);
   if (ret < 0) { printf("ERR: WriteUSB: Could not write: %i\n", ret); }
   debug(0, buffer, ret);
   return ret;
}



Here's what happens:

Code: Select all
flyingfisch@Office-Optiplex-745:~/Desktop/xfer9860-0.2.1$ scons -Q
Traceback (most recent call last):
  File "/usr/bin/scons", line 187, in <module>
    import SCons.Script
  File "/usr/lib/scons/SCons/Script/__init__.py", line 131, in <module>
    import SConscript
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 68, in <module>
    launch_dir = os.path.abspath(os.curdir)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory

Next

Return to General

Who is online

Users browsing this forum: No registered users and 46 guests