Showing posts with label driver. Show all posts
Showing posts with label driver. Show all posts

2009-01-27

Toshiba G450 en OS X - funcionando sin reiniciar

Por fin me he dedicado a jugar un poco con el driver oficial. El resultado esperado, como Nexus había comentado antes en otro post, era que el G450 sólo funcionase si estaba enchufado desde el arranque.

Pero en mi caso era peor: ni siquiera así funcionaba. Además he visto por la red más gente con el mismo problema. El "Toshiba PC Tool.app" que se instala junto al driver simplemente dice que no encuentra el modem, y ni siquiera aparece montado el disco USB que debería aparecer al conectar el G450.

El Perfil del Sistema muestra sin embargo que en el bus USB está conectado un disco de Toshiba, y la Consola muestra que diskarbitrationd no ha podido crear un disco ("unable to create /dev/disk2"). Esto se mantuvo así aunque reseteé el G450 y reformateé el disco con el propio menú del teléfono/modem/bicho.

Pero he encontrado una solución, que aunque no es ideal, tampoco cuesta mucho. Cuando el G450 está apagado y es enchufado al ordenador, la pantalla muestra una animación de carga de batería. Y el Perfil del Sistema muestra que hay un disco USB conectado. Cuando el G450 está encendido y es enchufado al ordenador, también se comporta como un disco. Pero se enciende un LED verde en la pantalla del modem. En Windows y Linux, cuando el G450 pasa al modo modem (gracias a un comando que el driver le manda), ése LED verde se pone azul. Y esto no estaba sucediendo en el Mac.

Pero en uno de los reinicios que probé, resultó que el LED se puso azul justo cuando el ordenador se apagaba. Y así se quedó cuando reinicié (no lo desconecté). Así que esta vez el Toshiba PC Tool sí que encontró el modem y ofreció un botón de "Conectar". Por fin! (también creó 3 interfaces de red nuevos, que seguramente permitirán manejar el modem más fácilmente mediante los Ross' Scripts, igual que ya hago con el Huawei E220. Pero eso, para otro día)

Así que: por alguna razón, el G450 está pasando a modo modem cuando el ordenador se apaga. Supongo que el driver de almacenamiento USB de OS X se adueña del G450 (aunque no consigue crear el disco!) así que el driver de Toshiba no puede mandar el comando de cambio de modo; y durante el apagado, cuando el driver de almacenamiento USB libera el disco, el driver de Toshiba por fin consigue mandar el comando justo antes del apagado final. O quizás es sólo un efecto secundario del apagado del bus USB, oiga. Quién sabe. En cualquier caso, funciona y es repetible.

Pero lo mejor es que no hace falta el apagado. Resulta que si pones el Mac a dormir (menú manzana -> reposo, o por ejemplo cerrando la tapa del Macbook) el efecto es el mismo: el LED se pone azul, y después el Toshiba PC Tool funciona. (ojo, el Mac no se queda dormido! Debe haber algún problema, porque inmediatamente después de empezar a dormir se despierta, y si la tapa está cerrada vuelve a dormir y a despertarse..... lo cual me temo que provocará algún cuelgue en algún momento. Así que si vas a probar esto, primero guarda lo que tengas abierto. De todas formas, quizás el problema del duerme-despierta sea cosa de los chungos drivers de Huawei que tengo instalados, que también instalaron un kext sobre algo de "USB wakeup"...)

En fin: finalmente he podido usar el G450 en mi Macbook. Ahora tocará ver si es mejor que el E220... que da bastantes problemas cuando lo usas con programas P2P con el operador Play. (aún no sé si es por drivers chungos o porque Play esté haciendo alguna jugarreta... cuando pueda, tendré que experimentar un poco con algún detector de gracias, como el Switzerland de la EFF).

Por completitud: he probado a descargar el driver de almacenamiento USB para ver si así el driver de Toshiba funciona mejor (mediante "sudo kextunload -b com.apple.iokit.IOUSBMassStorageClass"). Pero no sólo no funciona, sino que deja de funcionar el truco de dormir al mac. Así que mejor no tocarlo.

Otra forma de forzar el paso al modo modem sería usando USB_ModeSwich, que en OS X funciona tras desactivar el driver de almacenamiento USB... pero mientras no me provoque algún cuelgue, seguiré usando el truco de dormirlo. Más rápido ;P.

Toshiba G450 working in OS X - whitout a reset!

Finally I have had the chance to play a bit with the official driver. Remember, the expected result was that it would only work if plugged since the booting of the Mac. That would be unfunny, but in my case it was even worse: as a lot of other people has reported, it didn´t seem work at all. The "Toshiba PC tool.app" reported that no modem was found, and no USB disk appeared, even though I tried resetting and reformating the G450 internal disk (through its own configuration menu). But finally I have found a solution. Not ideal, but not too painful, and it works. The problem was that the modem would remain in the disk mode - which in my Mac at least doesn´t even work properly, since it doesn´t get mounted as a disk. The only way I can see that it is supposed to behave like a disk is because it appears in System Profiler.app, in the USB devices list. And Console.app shows something about diskarbitrationd "unable to create /dev/disk2". When the G450 is turned off and gets connected to the computer, it displays a charging battery animation. And System Profiler reports a USB disk. When the G450 is turned on and gets connected to the computer, it also behaves like a disk. But a green LED glows in the modem´s screen. In Windows and Linux, when the G450 does switch to the modem function (thanks to a command which the driver should be sending to it), this green LED turns blue. And this wasn´t happening in the Mac. But during one of the reboots I tried, I noticed that the LED went blue just when the computer shut down. So, next start up, the G450 (which was still connected) was still in the modem mode, and this time the Toshiba PC tool app started up, detected the modem and offered a "Connect" button. Finally! (it also created 3 network interfaces, which surely will allow to control the modem through Ross' Scripts instead of the shitty Toshiba app, like I am doing now with the Huawei E220. But more on that some other day) So: somehow the G450 is switching to modem function when the computer shuts down. My guess is that the USB storage driver of OS X takes control of the G450 so the Toshiba driver can´t send the mode switch command, and when shutting down the USB storage driver finally lets go and the Toshiba driver manages to send the command just before the final shut down. Or maybe it is just some secondary effect of the USB bus going down. Anyway, it works, and is repeatable. But the best part is: there is no need to shut down. Turns out, that by putting the Mac to sleep (with the Sleep option in the Apple menu, or by closing the lid of the Macbook, for example) the effect is the same: the green LED turns blue, and afterwards the Toshiba PC tool works. (also, the Mac won´t really go to sleep! Looks like the G450 makes it to wake up as soon as it starts sleeping - but if the lid is closed the Mac will keep trying to sleep and immediately waking up. Not nice, I won´t be surprised if that causes some crash, and would recommend to save anything important you may have before trying that. Anyway, maybe this waking up effect I am seeing has something to do with the also nasty drivers from Huawei, which also installed some "USB wakeup" kext...). So finally I have been able to use the G450 in the Macbook. Now I will have to see if it is any better than the E220... which with polish operator Play is quite difficult to keep connected while using P2P apps. (I still don´t know if that is because of the Huawei drivers or because of the operator doing something funny... When I can I will experiment a bit with EFF's Switzerland or some other "funnyness detector") Just for completeness: I have tried to unload the USB Mass Storage driver in OS X to see if the Toshiba driver would work (with "sudo kextunload -b com.apple.iokit.IOUSBMassStorageClass"). No joy, and that even prevents the sleeping trick from working. So, better to leave that alone. (It works again after reloading the storage driver) Another way to force the mode switch would be using USB_ModeSwitch, which in OS X works after unloading the storage driver. But, until the sleeping trick causes any crash, I'll stick to it.

2008-11-12

Official driver for the G450?

The only problem is, it doesn't seem to work. It installs, but nothing else happens. And the Toshiba PC Tool app it installs always complains that the modem can't be found.

I'll take it as a warning that I'm letting too much time pass by without working on the subject... although I still think about it and read the needed docs whenever life's DDoS leaves me some room to breathe. (In the last 3 weeks I finished the polish course, passed the exam with good marks, started the new course, enjoyed the trip, finished my previous job – with still some rough edges to be taken care of, did the paperwork to end my previous self-employment in Spain and start the new job in Poland, did the paperwork relating to spanish telephony and bank accounts, and started the new job. Now I only have to finish the flat moving and basic set up...)

(Hm, surely I should write some short article about all that Polish red tape...)

But, back to the subject, the thing is I should start pushing the driver programming thing, because I guess at some moment Toshiba will publish a working driver... I could work on it anyway, of course, but it would just be an exercise, instead of having a real interest!
UPDATE, 12 nov 08: A comment by NexOSX on the spanish version of this post says that the OS X official driver does in fact work - if the modem is connected at boot time, and is not disconnected afterwards. WTF? I will have to check it, even though if it works like that, to me it's next to useless - and I guess for any (i|Mac)Book user on the go.

2008-10-05

Driver oficial para el Toshiba G450

Pues parece que finalmente en Toshiba se han decidido a publicar un driver para Mac OS X para el modem 3G.

Lo curioso es que a mí no me funciona. Se instala, pero... no veo que haga nada de nada. Me lo tomaré como un aviso de que llevo mucho tiempo sin avanzar el tema. Pero sigo pensando en ello y tocando los libros cuando el resto de la vida me deja... Ya he acabado el anterior curso de polaco (aprobé el examen con buena nota!, y ha empezado el nuevo curso), acabó el viaje, acabó el antiguo trabajo (más o menos – aún quedan cabos sueltos por amarrar), acabaron los papeleos de baja como autónomo en España y alta como trabajador en Polonia, acabaron los papeleos de telefonía y bancos en España, y he empezado el nuevo trabajo. Sólo falta acabar la mudanza y acabar de arreglar lo más básico del nuevo piso. No está mal para 3 semanas, oiga.

Pero la cuestión es que tendré que ponerme las pilas con el driver, porque supongo que en algún momento Toshiba sacará un driver que sí que funcione... (Siempre podría acabarlo de todas formas, pero pierde interés / morbo, claro :) ).

2008-08-15

Making a Mac OS X driver for the Toshiba G450 3G modem

About 3 weeks ago, I had to buy the 3G modem Toshiba G450 because Polish operator Play would not let me get the plan I wanted without it.

A few hours later, I had to accept that there are no Mac OS X drivers for it! Which would have made me, say, unhappy, had I not had my trusty Huawei E220. The only information I have been able to come up with are amazed reviews from gadget websites. Not even a driver for Linux... And this happens when I was thinking about polishing my low-level development powers (there is more to life than Java and C#, you know!)... so, why not take the chance to learn about what is needed to make a driver?

The modem uses the ZeroCD "trick" of appearing as a USB drive to the OS, until it receives an existent-but-generally-unused-in-USB-drives command; at that moment, the drive is "unplugged" and a new device appears in the bus: the modem. So in the USB drive that appears first, there is a driver installer (for Windows, of course). The user (or the autorun) installs the driver, and it sends the switching command to the USB drive it recognizes as the masked modem. Drive goes away, modem appears, and driver finally does its thingy with the modem.

Up to now, I have been successful in capturing the appropiate command with usbsniff and making the USB drive switch in Linux and Mac OS X, with the help of usb_modeswitch (http://www.draisberghof.de/usb_modeswitch/ , where I have already sent the info so they can use it in later versions). So now the modem is waiting for my next move. I was half expecting it to just be recognized by the serial driver, but that would have been too easy, wouldn't it?

So I have been reading about the internals of USB, now about IOKit (the driver subsystem in OS X), have re-learnt C in a rush, and now am contemplating starting with C++, of which IOKit uses "a restricted subset" (no RTTI, no templates, no exceptions... which in part I guess will make the thing easier, although I am afraid those were the interesting parts of it). And yet looks like I will have to read a bit about kernel programming in OS X. Which is also something I wanted to do, but... I was expecting this first project to be a little lighter!

On the other hand, I am suspecting this won't be THAT difficult. The Huawei E220's software for OS X (driver and app) doesn't look exactly brilliant, which makes me think someone hacked it together somewhat quickly; and it works in a similar way to the Toshiba G450. I even thought about hacking a bit the Huawei's kernel extension (looks like I should only edit an XML file in the bundle), but even if it worked I don't think I would be able to distribute it nor would I learn anything. And I don't actually need the modem ;P.

Also, the Darwin open source repositories have an example driver for USB modems. And after all we are only talking about making the OS see "the serial ports" in the USB interfaces... I mean, it should be as easy as it can get, since everything beyond that point will be taken care of by other parts of the OS. But still this is about kernel programming in C++ for a novice. Lots of little interestingly nasty ways to hose the whole OS. Nice!

Of course, no small part of the problem is making sense of all of this and still having time for language courses, travelling, personal life... and my regular job - and searching for a new one. Sounds a bit like DDoS, doesn't it? :)