Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c
  2. index 1d1802a..de7bb8b 100644
  3. --- a/arch/arm/mach-msm/smd_tty.c
  4. +++ b/arch/arm/mach-msm/smd_tty.c
  5. @@ -20,6 +20,7 @@
  6. #include <linux/device.h>
  7. #include <linux/wait.h>
  8. #include <linux/wakelock.h>
  9. +#include <linux/delay.h>
  10.  
  11. #include <linux/tty.h>
  12. #include <linux/tty_driver.h>
  13. @@ -27,6 +28,7 @@
  14.  
  15. #include <mach/msm_smd.h>
  16. #include <mach/amss_para.h>
  17. +#include "board-htcleo.h"
  18.  
  19. #define MAX_SMD_TTYS 32
  20.  
  21. @@ -197,8 +199,11 @@ static int smd_tty_write(struct tty_struct *tty,
  22. const unsigned char *buf, int len)
  23. {
  24. struct smd_tty_info *info = tty->driver_data;
  25. - int avail;
  26. - int ret;
  27. + int avail, ret, runfix=0;
  28. + static int init=0;
  29. + const unsigned char* firstcall="AT@BRIC=0\r";
  30. + const unsigned char* secondcall="AT+COPS=2\r";
  31. + unsigned int call_len;
  32.  
  33. /* if we're writing to a packet channel we will
  34. ** never be able to write more data than there
  35. @@ -207,10 +212,32 @@ static int smd_tty_write(struct tty_struct *tty,
  36. #ifndef CONFIG_MACH_HTCLEO
  37. mutex_lock(&smd_tty_lock);
  38. #endif
  39. + if(len>7 && !init && htcleo_is_nand_boot()) {
  40. + if(strncmp(buf, "AT+CFUN", 7)==0) {
  41. + pr_info("SMD AT FIX!\n");
  42. + call_len = strlen(firstcall);
  43. + avail = smd_write_avail(info->ch);
  44. + if (call_len > avail)
  45. + call_len = avail;
  46. + ret = smd_write(info->ch, firstcall, call_len);
  47. + init=1;
  48. + runfix=1;
  49. + msleep(100);
  50. + }
  51. + }
  52. avail = smd_write_avail(info->ch);
  53. if (len > avail)
  54. len = avail;
  55. ret = smd_write(info->ch, buf, len);
  56. + if(runfix) {
  57. + msleep(100);
  58. + pr_info("SMD AT FIX2!\n");
  59. + call_len = strlen(secondcall);
  60. + avail = smd_write_avail(info->ch);
  61. + if (call_len > avail)
  62. + call_len = avail;
  63. + ret = smd_write(info->ch, secondcall, call_len);
  64. + }
  65. #ifndef CONFIG_MACH_HTCLEO
  66. mutex_unlock(&smd_tty_lock);
  67. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement